Jump to content

Movement Tracker


MikeFez
 Share

Recommended Posts

I have fixed the problem of scanning in the corner of the screen, the Pixel search has been ajusted thanks to erifash. Again, not much has been added, but I did add a placeholder for a ball.. so far its just a windows icon thats located on the top left of the screen... does anyone know how to make it appear over the camera image? It kinda flickers over it, then it goes under it untill its created again...

Link to comment
Share on other sites

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Cool !

I'll learn from this to write a code about Motion Detection on webcam for security... thanks.

Yea, I originally was going to check if the image had changed but for some reason (probably because of focusing) the pixels would change slightly, so if your going to do that I reccomend that you pick random pixels around the image and scan them for the color they are currently, but set the shade to 5 or 10 or something so that if they change slightly it isnt a problem... then if an error comes up because it cant find it, it saves the image with a timestamp or something...

But yea, i'm still having this picture problem and I'm not sure on how to fix it, I'm making another camera utility alongside this one thats being worked on, Its pretty basic but cool... so anyways, can anyone tell me why the image doesnt appear ontop of the camera's image? If i get no responce i'll post this in the support forum

Link to comment
Share on other sites

<can anyone tell me why the image doesnt appear ontop of the camera's image?>

I heard something about Hardware Accelerator draws webcam images (drawing area's "float" on your desktop). This's the same reason why you can't use print screen to capture video playing. Try to disable Hardware Acc. in Desktop properties/VGA driver properties/etc... (let windows renders webcam images)

>> AutoMee << NICE AutoIt UTILITY THAT I CAN'T LIVE WITHOUT !
Link to comment
Share on other sites

  • 1 year later...

my first script interactiv pingpong

CODE

#include <GUIConstantsEx.au3>

#include <Webcam.au3>

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

$Main = GUICreate("",@desktopwidth,@DesktopHeight,0,0,$WS_POPUPWINDOW)

_WebcamInit()

sleep(400)

$open = _Webcam($main,@desktopwidth,@DesktopHeight,0, 0)

global $x

global $y

$x = 6

$y = 6

$count = 1

$Ball = GUICtrlCreateLabel ( "", $x, $y, 10, 10 )

GUICtrlSetBkColor ( -1, 0x120000 )

$user1 = GUICtrlCreateLabel("",10,10)

$user2 = GUICtrlCreateLabel("",10,10)

guisetstate()

sleep(2000)

Do

$ran1 = Random(5,15)

$ran2 = Random(5,15)

if guictrlread($user1) = "" then

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

$p = MouseGetPos()

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

GUICtrlSetData($user1,$col1)

endif

if GUICtrlRead($user2) = "" Then

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

$t = MouseGetPos()

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

GUICtrlSetData($user2,$col2)

EndIf

$play1 = PixelSearch($x - 5,$y - 5 ,$x + 15,$y + 15,guictrlread($user1),5,5)

If Not @error Then

MouseMove($play1[0], $play1[1], 0)

ToolTip("Player1 Found", 0, 0)

beep(250, 100)

$i = 0

while $i <=10

$i = $i +2

$y = $y - $ran1

$x = $x - $ran2

WEnd

EndIf

$play2 = PixelSearch($x - 5,$y - 5 ,$x + 15,$y + 15,guictrlread($user2),5,5)

If Not @error Then

MouseMove($play2[0], $play2[1], 0)

ToolTip("Player2 Found", 0, 0)

beep(150, 100)

while $i <=10

$i = $i +2

$y = $y + $ran1

$x = $x + $ran2

WEnd

EndIf

if $count = 1 Then

$y = $y + $ran1

$x = $x + $ran1

sleep(2)

EndIf

if $count = 2 Then

$y = $y - $ran1

$x = $x + $ran1

beep(100,100)

sleep(1)

EndIf

if $count = 3 Then

$y = $y - $ran1

$x = $x - $ran1

sleep(1)

EndIf

if $count = 4 Then

$y = $y + $ran1

$x = $x - $ran2

sleep(1)

EndIf

if $y >= @DesktopHeight Then

$count = 2

EndIf

if $x >= @DesktopWidth Then

$count = 3

EndIf

if $x <= 2 Then

$count = 1

EndIf

if $y <= 2 Then

$count = 4

EndIf

GUICtrlSetPos($ball,$x,$y)

GUICtrlSetPos($play1,$x - 5,$y - 5)

GUICtrlSetPos($play2,$x - 5,$y - 5)

until 1 = 2

func stop()

_WebcamStop()

sleep(2000)

Exit

EndFunc

Link to comment
Share on other sites

help me,

not detect camera (message apper on video) then

webcampong.au3 (105) : ==> Variable used without being declared.:

$Main = GUICreate("Camera",455,290,0,0, $WS_DLGFRAME)

$Main = GUICreate("Camera",455,290,0,0, ^ ERROR

can anyone help me ?

m.

Link to comment
Share on other sites

help me,

not detect camera (message apper on video) then

webcampong.au3 (105) : ==> Variable used without being declared.:

$Main = GUICreate("Camera",455,290,0,0, $WS_DLGFRAME)

$Main = GUICreate("Camera",455,290,0,0, ^ ERROR

can anyone help me ?

m.

I don't know about the camera not being detected, but with the undeclared variable, you need to place this at the top of your script.

#include <WindowsConstants.au3>

My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

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...