Jump to content

webcam motion detection


mary
 Share

Recommended Posts

here's the script i did some testing with

you can use any picture, but they have to be the same size

you need prospeed3.0.dll and the prospeed3.0 udf for it

download @ http://prospeed-jan.xprofan.com/

i cannot anwser any questions for 10 days, holiday in spain :)

#include <prospeed3.0.au3>

GUICreate("Compare 2 images", 800, 400)
GUISetState()

$hdc = GetHDC()

$clock1  = LoadFileImage("clock.png")
$size = GetInfosImage($clock1,7)

$clock2 = CreateImage(400,400)
PaintImage($clock2,0,0,400,400,$clock1,0,0,0)
ColorFillImage($clock2,398,398,400,400,0xFFFFFF)

PaintImage($hdc,0,0,400,400,$clock1,0,0,0)
PaintImage($hdc,400,0,400,400,$clock2,0,0,0)

CreateBuffer(800,400)
SetBuffer($hdc)

$array1 = InitFX($clock1)
$array2 = InitFX($clock2)

$Struct1 = DllStructCreate("byte["&$size&"]")
$Struct2 = DllStructCreate("byte["&$size&"]")

$mem1 = SaveToMemoryFX($array1, DllStructGetPtr($Struct1))
$mem2 = SaveToMemoryFX($array2, DllStructGetPtr($Struct2))

$time = TimerInit()

$chk2 = CompareBytes(DllStructGetPtr($Struct1), DllStructGetPtr($Struct2), $size, 0)

$stop = TimerDiff($time)
MsgBox(0,$stop,$chk2)

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then 
        $Struct1 = ""
        $Struct2 = ""
        FreeAllImages()
        FreeFX($array1)
        FreeFX($array2)
        DestroyBuffer()
        Exit        
    EndIf
WEnd
Link to comment
Share on other sites

  • 1 month later...

hi im a newby but i made this little script that lets you do a pixel search on one area ov the web cam and select two colors and if thay are not ther then it takes a snap shot of the person there this is my first script you need webcam udf for this

CODE

#include <GUIConstantsEx.au3>

#include <Webcam.au3>

$intruder = 1

$hight = @DesktopHeight / 2

$width = @DesktopWidth / 2

HotKeySet("{esc}","stop")

$Main = GUICreate("Camera",260,260,$width - 100,$hight - 100,$WS_DLGFRAME)

_WebcamInit()

sleep(400)

$open = _Webcam($main,250,250,0, 0)

guisetstate()

msgbox(0,"left","please select left side of object")

$l1 = MouseGetPos()

$l = $l1[0]

msgbox(0,"top","please select top side of object")

$t1 = MouseGetPos()

$t = $t1[1]

msgbox(0,"right","please select right side of object")

$r1 = MouseGetPos()

$r = @DesktopWidth - $r1[0]

msgbox(0,"bottom","please select bottom side of object")

$b1 = MouseGetPos()

$b = @DesktopHeight - $b1[1]

MsgBox(0,"colour","please select coluor")

$p = MouseGetPos()

$col = PixelGetColor($p[0],$p[1])

MsgBox(0,"colour","please select coluor 2")

$t = MouseGetPos()

$col1 = PixelGetColor($t[0],$t[1])

MsgBox(0,"dimentions",$l &" " & $t &" " & $r &" " & $b &" " )

sleep(2000)

$intruder = 1

Do

$co1 = PixelSearch($l,$t,$r,$b,$col,5,1)

$co2 = PixelSearch($l,$t,$r,$b,$col1,5,1)

if not @error = 1 Then

beep(100,100)

$intruder = $intruder +1

$snapfile = "c:\intruder"& $intruder

_WebcamSnapShot()

sleep(5000)

EndIf

until 1 = 2

func stop()

_WebcamStop()

$sleep(2000)

Exit

EndFunc

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...