Jump to content
Sign in to follow this  
7h331337

green and blue screen pictures

Recommended Posts

7h331337

this app takes the image with a green or blue screen in it and replaces it with ur pi it works gritty quick and you can save your image and u can do the old ipod pics so u take all colors except green or blue

how to use

select color-->click open select files-->adjust tolerance __>click invert create or create --> change file name at top-->save

edit:

updated

thanks to monoceres and ludocus for the udf's

#include <GUIConstants.au3>
#include <windowsConstants.au3>
#include <screencapture.au3>
#include <movie.au3>
#include <aviudf.au3>

Global $percent1
Global $mov
$p = 0
#Region ### START Koda GUI section ### Form=
$gui = GUICreate("Form1", 514, 260, 0, 0, $ws_popup)
$Pic1 = GUICtrlCreatePic("", 0, 0, 201, 201)
$Pic2 = GUICtrlCreatePic("", 200, 0, 201, 201)
$Button1 = GUICtrlCreateButton("Open", 408, 96, 97, 17, 0)
$Button2 = GUICtrlCreateButton("Create", 408, 120, 97, 17, 0)
$Button6 = GUICtrlCreateButton("crate avi", 408, 139, 97, 17, 0)
$Button5 = GUICtrlCreateButton("invert craete", 408, 184, 97, 17, 0)
$Button4 = GUICtrlCreateButton("Exit", 408, 232, 97, 17, 0)
$shade = GUICtrlCreateSlider(0, 232, 401, 17)
$Label1 = GUICtrlCreateLabel("tolerance", 8, 216, 68, 17)
$Button3 = GUICtrlCreateButton("Save", 408, 208, 97, 17)
$Label2 = GUICtrlCreateLabel("Filename to save as", 408, 56, 98, 17)
$Prog1 = GUICtrlCreateProgress(408, 160, 97, 17)
$Input1 = GUICtrlCreateInput("def.jpg", 408, 72, 97, 21)
$Radio1 = GUICtrlCreateRadio("Green", 408, 8, 81, 17)
$Radio2 = GUICtrlCreateRadio("Blue", 408, 32, 81, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
main()
Func main()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button1
                open()
            Case $Button2
                create()
            Case $Button3
                save()
            Case $Button4
                exit1()
            Case $Button5
                box()
            Case $Button6
                createvid()
        EndSwitch
    WEnd
EndFunc   ;==>main


Func exit1()
    Exit
EndFunc   ;==>exit1
Func open()
    $f1 = FileOpenDialog("select green/blue screen image", @DesktopDir, "images (*.jpg;*.bmp)")
    GUICtrlSetImage($Pic1, $f1)
    $f2 = FileOpenDialog("select background image image", @DesktopDir, "images (*.jpg;*.bmp)")
    GUICtrlSetImage($Pic2, $f2)
EndFunc   ;==>open
Func create()
    $hdc = DllCall("user32.dll", "int", "GetDC", "hwnd", "")
    per(201 * 201)
    $percent = 0
    $y = 0
    If GUICtrlRead($Radio1) = 1 Then
        $col = "0x00BF00"

    ElseIf GUICtrlRead($Radio2) = 1 Then
        $col = "0x3163FF"

    Else
        MsgBox(0, "error", "select green or blue backgroung")
        main()
    EndIf
    
    For $i = 0 To 202 Step 1
        
        If $y = 202 Then
            $y = 0
            $i = 0
            $p = 1
            main()
        EndIf
        $pix = PixelSearch($i, $y, $i, $y, $col, GUICtrlRead($shade) * 2)

        
        If Not @error Then
            $col1 = PixelGetColor($i + 200, $y)
            DllCall("gdi32.dll", "long", "SetPixel", "long", $hdc[0], "long", $i + 200, "long", $y, "long", $col1)
            $col2 = PixelGetColor($i + 200, $y)
            DllCall("gdi32.dll", "long", "SetPixel", "long", $hdc[0], "long", $i, "long", $y, "long", $col2)
        EndIf
        


        
        
        If $i >= 201 Then
            $i = 0
            $y = $y + 1
        EndIf

        $percent = $percent + $percent1
        GUICtrlSetData($Prog1, $percent)
    Next

EndFunc   ;==>create
Func save()
    _ScreenCapture_Capture(GUICtrlRead($Input1), 0, 0, 201, 201)
    
EndFunc   ;==>save

Func per($stringp)
    $percent1 = 100 / $stringp
    Return $percent1

EndFunc   ;==>per
Func box()
    $hdc = DllCall("user32.dll", "int", "GetDC", "hwnd", "")
    per(201 * 201)
    $percent = 0
    $y = 0
    If GUICtrlRead($Radio1) = 1 Then
        $col = "0x00BF00"

    ElseIf GUICtrlRead($Radio2) = 1 Then
        $col = "0x3163FF"

    Else
        MsgBox(0, "error", "select green or blue backgroung")
        main()
    EndIf
    
    For $i = 0 To 202 Step 1
        
        If $y = 202 Then
            $y = 0
            $i = 0
            $p = 1
            main()
        EndIf
        $pix = PixelSearch($i, $y, $i, $y, $col, GUICtrlRead($shade) * 2)

        
        If @error Then
            $col2 = PixelGetColor($i + 200, $y)
            DllCall("gdi32.dll", "long", "SetPixel", "long", $hdc[0], "long", $i, "long", $y, "long", $col2)
        EndIf
        


        
        
        If $i >= 201 Then
            $i = 0
            $y = $y + 1
        EndIf

        $percent = $percent + $percent1
        GUICtrlSetData($Prog1, $percent)
    Next


EndFunc   ;==>box
Func createvid()
    $col = "0x00BF00"
    _StartAviLibrary()
    $avi = _CreateAvi(@DesktopDir & "\myvid.avi", 5,201,201)
    GUICtrlSetState($Pic1, @SW_HIDE)
    $f2 = FileOpenDialog("select background image image", @DesktopDir, "images (*.jpg;*.bmp)")
    GUICtrlSetImage($Pic2, $f2)
    $file = FileOpenDialog("select avi file", @DesktopDir, "avi (*.avi)")
    GUICtrlSetData($Label1, "record length")
    MsgBox(0, "Ajust!!!", "ajust slider for record lenth")

    $mov = _MovieOpen($file, $gui, 0, 0, 201, 201)
    _MoviePlay($mov)
    For $ini = 1 To $shade * 5 Step 1
        _ScreenCapture_Capture(@DesktopDir & "/avi/avicreate" & $ini & ".jpg", 0, 0, 201, 201)
        Sleep(40)

    Next

    _MovieClose($mov)
    GUICtrlSetState($Pic1, @SW_SHOW)
    $hdc = DllCall("user32.dll", "int", "GetDC", "hwnd", "")
    per(201 * 201)
    $percent = 0
    $y = 0
    If GUICtrlRead($Radio1) = 1 Then
        $col = "0x00BF00"

    ElseIf GUICtrlRead($Radio2) = 1 Then
        $col = "0x3163FF"

    Else
        MsgBox(0, "error", "select green or blue backgroung")
    EndIf
    GUICtrlSetData($Label1, "record tolerance")
    MsgBox(0, "ajust!!!", "ajust slider for tolerance")
    For $vid = 1 To $ini Step 1
        GUICtrlSetImage($pic1,@desktopdir & "/avi/avicreate" & $vid & ".jpg")
        GUICtrlSetImage($Pic2, $f2)
        For $i = 0 To 202 Step 1
            $pix = PixelSearch($i, $y, $i, $y, $col, GUICtrlRead($shade) * 2)           
            If Not @error Then
                $col1 = PixelGetColor($i + 200, $y)
                DllCall("gdi32.dll", "long", "SetPixel", "long", $hdc[0], "long", $i + 200, "long", $y, "long", $col1)
                $col2 = PixelGetColor($i + 200, $y)
                DllCall("gdi32.dll", "long", "SetPixel", "long", $hdc[0], "long", $i, "long", $y, "long", $col2)
            EndIf           
            If $i = 201 Then
                $i = 0
                $y = $y + 1
            EndIf
            if $y = 202 then 
                $i = 202
            EndIf
            
            $percent = $percent + $percent1
            GUICtrlSetData($Prog1, $percent)
        Next
        $y = 0
        $i = 0
        $p = 1
        $percent = 0
        $hBmp = _ScreenCapture_Capture("", 0, 0, 201, 201)
        _AddHBitmapToAvi($avi, $hBmp)
        _WinAPI_DeleteObject($hBmp)
            GUICtrlSetState($Button1, @SW_DISABLE)
    GUICtrlSetState($Button2, @SW_ENABLE)
    GUICtrlSetState($Button3, @SW_ENABLE)
    GUICtrlSetState($Button4, @SW_ENABLE)
    GUICtrlSetState($Button5, @SW_ENABLE)
    Next
    _CloseAvi($avi)
    _StopAviLibrary()
EndFunc   ;==>createvid

post-36523-1231652120_thumb.jpg

post-36523-1231652128_thumb.jpg

post-36523-1231652441_thumb.jpg

aviudf.au3

movie.au3

Edited by 7h331337

Share this post


Link to post
Share on other sites
corgano

script updated

how about your spelling?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
7h331337

how about your spelling?

1. spelling dose not matter

2. i am dyslexic <-- google i cant spell that at all

Share this post


Link to post
Share on other sites
gseller

That is way cool! I can see if the images were of good quality would make it easy for those that do not know how to use photoshop to basically morph images.. If you get it to doing video that will be fantastic, looking forward to seeing wherte you take this..

edit: type-o

Edited by gseller

Share this post


Link to post
Share on other sites
7h331337

That is way cool! I can see if the images were of good quality would make it easy for those that do not know how to use photoshop to basically morph images.. If you get it to doing video that will be fantastic, looking forward to seeing wherte you take this..

edit: type-o

cheers i should be finished doing the video by 2 night or 2moz

Share this post


Link to post
Share on other sites
7h331337

can now do video just click create avi

edit: you must make a file on your desktop called avi

Edited by 7h331337

Share this post


Link to post
Share on other sites
corgano

bump!!!

this is a form where bumping is frowned upon. please stop

if you need a file on desktop named avi then make your script make the avi. shouldnt be hard.


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×