| Whlie it is true that obviously getting a better picture is going to give better results, I can vouch for the methods I mention because I use them (for quite different end purposes, but same methodology nevertheless). http://www.memo.tv/webcam_piano uses a very basic implementation of the first method I explain. http://www.memo.tv/webcam_piano_with_processing_v0_1 does a much more accurate implementation of the first method, but in processing. I later did a version using optical flow which I cannot find right now :S but you can easily adapt the optical flow sample I mention. The key thing is to NOT do any motion averaging on the frame - thats when any subtle motion will be absorbed by the noise, and no tricks of math can save that. If your images have noise (like mine do when using a webcam) - that noise is homogenous and evenly spread across the whole frame. Any genuine subtle movement (such as a mouse cursor moving, a person blinking) will be insignificant compared to the total amount of movement created in the whole frame due to noise - thats why you need to do local checks. A person blinking, or subtle mouse move is still quite a considerable movement if you look at a small region localized to that area. I.e. if you take the webcam piano example, create quite a largish grid, lower the threshold as low as it goes but still high enough to not be triggered by the noise. Any movement beyond that (person blinking, subtle mouse movement), will trigger one of the boxes. And your check should be if ANY of the boxes trigger, then there is genuine movement in the frame... I've attached a cut down version of the quartz composer webcam_piano (without any of the osc, note stuff). This simply scales down the video image a bit (that does the localized averaging), then iterates through all pixels, if any one pixel is greater than a threshold there is movement in the frame. The iterator is what goes through every pixel in the differenced image and displays a box if there is movement. Since you don't care where the movement is you can do something simpler... just do a CI threshold on the scaled down differenced image, then see if any pixel is white - and that you can do by doing an image histogram on the thresholded image, and looking to see if the value at [255] is non-zero (again, no averaging), i've added that in as well, just a few patches.... and since you don't need to do the iteration, you can get away with keeping the differenced frame much higher res (the numX and numY) - make sure you turn off the boxes though! will be very slow otherwise!. You probably will need to play with the threshold - bring it down as far as it goes before being triggered by noise. |
Webcam Piano just grid.qtz
Description: application/quartzcomposer
On 8 Jul 2008, at 04:41, aram wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]

