nimaid Posted December 5, 2009 Share Posted December 5, 2009 I want to make a program that will take a picture from my webcam, than take another and compare them. If there are any differences, than play a user defined sound and save the pic to a user defined directory. I am a newb and only know the basics so if you could help me with not only methods but possibly code snippets it would be greatly appreciated! This statement is a lie.˙uʍop-ǝpısdn sı ǝuo sıɥʇ ʇnq 'ǝıl ɐ ǝq ʎɐɯ ʇuǝɯǝʇɐʇs snoıʌǝɹd ǝɥʇ¡6u15nɟu0) ʎ||43ɹ 51 51ɥ7 Link to comment Share on other sites More sharing options...
wazze Posted December 5, 2009 Share Posted December 5, 2009 I want to make a program that will take a picture from my webcam, than take another and compare them. If there are any differences, than play a user defined sound and save the pic to a user defined directory. I am a newb and only know the basics so if you could help me with not only methods but possibly code snippets it would be greatly appreciated!its really dificult, because the noise of the cam, i think, i can't make 2 same pictures with the webcam, the noise other, and other on every picture, so its really hard to make, i think Link to comment Share on other sites More sharing options...
czardas Posted December 5, 2009 Share Posted December 5, 2009 Unfortunately I don't have a web cam so I can't really write/test any code, but I have an idea that might help. I think a solution could be to compair groups of pixels, located in the area you expect to see movement. If a percentage change in pixel colour occurs, then trigger an alarm. I'm guessing a bit, but I think you could set the sensitivity by changing the percentage and hopefully this will be able to differentiate between real movement and noise. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
somdcomputerguy Posted December 5, 2009 Share Posted December 5, 2009 Nimaid, perhaps this thread helps.. Webcam UDF - AutoIt Forums - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
whim Posted December 5, 2009 Share Posted December 5, 2009 If - besides the webcam - you also happen to own a Canon P&S digicam, you might want to check outCHDK, a hack for above cams that also has built in motion detectionHTH,whim Link to comment Share on other sites More sharing options...
skyboy Posted December 5, 2009 Share Posted December 5, 2009 i found (and played with) a very efficient flash motion detection app, the AS2 version got quite good speeds and with the right settings you can detect just the movement of eyes (blur: 2, minArea:2, everythingElse: 0, flip: false): http://blog.soulwire.co.uk/download/as3-motion-tracking i know the link says AS3, but it also has AS2 source code in it, though i recommend using the AS3 version if you can since it's going to be at least 2x as fast; you probably can't convert it to AutoIt code very efficiently but if you learn the basics of actionscript you can modify it so it reports information to autoit using FSCommand, possibly (though unlikely) ExternalInterface too this thread demonstrates how to set up accepting commands from flash's FSCommand: http://www.autoitscript.com/forum/index.php?showtopic=106257&view=findpost&p=750432 and somewhere there should be a reference for what functions/variables are exposed on the flash COM object, though i have been unable to find one Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted December 6, 2009 Share Posted December 6, 2009 A Ha.I tried doing this a while ago. I do not believe it is possible to ta a picture and then cross reference it with other pictures. The Webcam is bad quality, and the lighting will change throughout the day.What I did, was have a get pixel function on two points of the webcam display (Use Webcam UDF). I tried having it go off if it changed at all but there was too much noise in the signal...So I set up a variable treshold system for colour (Yes americans, this is the right spelling) change. It Sorta works.Hope this helps... ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
skyboy Posted December 6, 2009 Share Posted December 6, 2009 well, to account for the light and quality, you can blur it with a radius of 2 (the only way this will fail is if the blockyness is to the point you only have 4 or 6 squares of colour, total. the light is fixed because the change is so gradual (unless a light is turned on/off) that it isn't noticed from one frame to the next) and then you can look for a change greater than X pixels, for eye movement, 2 works well; for general movement, 5 works well, assuming they aren't in the distance, at that point the blur can remove them entirely Link to comment Share on other sites More sharing options...
nimaid Posted December 29, 2009 Author Share Posted December 29, 2009 Thank you all! I also thought that the getpixel function was the way to go, but had no idea how to get the pic, and static is pretty bad on my cam, but I think i can make this work. hank you! This statement is a lie.˙uʍop-ǝpısdn sı ǝuo sıɥʇ ʇnq 'ǝıl ɐ ǝq ʎɐɯ ʇuǝɯǝʇɐʇs snoıʌǝɹd ǝɥʇ¡6u15nɟu0) ʎ||43ɹ 51 51ɥ7 Link to comment Share on other sites More sharing options...
spudw2k Posted December 30, 2009 Share Posted December 30, 2009 Thank you all! I also thought that the getpixel function was the way to go, but had no idea how to get the pic, and static is pretty bad on my cam, but I think i can make this work. hank you!Just to leave your options open, you can use a pixelcheck function that isn't too strict. You can detect shades and variations to compensate for noise. Just my two cents if you want an autoit solution. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now