alpi42

plot image/graphic on webcam udf

1 post in this topic

Hi everybody, i created a gui where the webcam udf is shown. This is just working fine.

Now i want to plott an image or a graphic on the webcamwin in the gui. I tried it but the webcamwin is going every time over the graphic/image.

Need some tips to realise it and i upload the udf if you dont have it.

Here my code without a graphic or image:

#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include 'webcam.au3'
#include<GDIPlus.au3>
#include <Misc.au3>
#include<array.au3>

HotKeySet("{ESCAPE}", Ende)
Func Ende ()
Exit
EndFunc

$cam_xlength = 640;Breite
$cam_ylength = 480 ;Höhe

$gui = GUICreate("", $cam_xlength, $cam_ylength + 90, 0, 0)
$zahlen = GUICtrlCreateLabel("0", 128, 528, 10, 17)
$spielen = GUICtrlCreateButton("spielen", 16, 520, 75, 25)
$WebcamID = _WebcamOpen($gui, 0, 0, $cam_xlength + 30, $cam_ylength)
_GDIPlus_Startup()
$WebcamID = _WebcamOpen($gui, 0, 0, $cam_xlength + 30, $cam_ylength)
$TEST = GUICtrlCreateButton("TEST",  280, 512, 75, 25)
WinSetTrans($gui, "", 170)
GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $TEST
            $dll = DllOpen("user32.dll")
                while 1
                    If _IsPressed("01", $dll) Then
                    $aPos = MouseGetPos()
                    Local $iColor = PixelGetColor($aPos[0], $aPos[1])
                    $Label1 = GUICtrlCreateLabel( "0x"&Hex($iColor), 160, 512, 45, 20)
                    GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif")
                    GUICtrlSetColor(-1, "0x"&Hex($iColor))
                        while 1
                            $aCoord = PixelSearch(0, 0, $cam_xlength + 30, $cam_ylength, "0x"&Hex($iColor),5 )
                            if not @error Then
                            MouseMove($aCoord[0],$aCoord[1])
                            EndIf
                            WEnd
                    ExitLoop
                    EndIf
                WEnd
        Case $spielen

EndSwitch
WEnd

 

webcam.au3

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