I am trying to find a way to compare a part of two pictureboxes in order to find out motion of an object between the two images.
Is there any other way than using point statement?
You could try merging the images with a API Bit Block Transfer call using XOR. That should only leave difference between the images. You could then scan the image file to check for non black pixels
In fact that's what I tried (and indeed this is a working option!) I was interested to do it without the time consuming scanning using the picture1.point construction.
I merely move through all the pixels (step 10) and compare the same pixels in two different pictureboxes.
If the difference between their RGB values exceeds my sensetivity value(which is about 1500000, then there has definately been motion and I can even pinpoint the exact location of where the motoin was first detected, with a neet circle drawing.
The only drawback now is that I am using 3 pictureboxes, one for the live video, and two for the twp comparing pics.
Any ideas or thoughts are welcome...
**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
a) that's not really motion detection...(imagine I had a light in the field of view. Simply switching it on and off would be detected as 'motion' using your approach)
b) it is likely to be slow (pixel-by-pixel comparison in VB), and not keep up with the frame rate delivered by the camera
You say <If the difference between their RGB values exceeds my sensetivity value(which is about 1500000,>
RGB values are Longs which represent 3 Ints (1 each for R, G and B). Viewed as Hex, an RGB value looks like BBGGRR, so your sensitivity figure of 1500000 represents a change in Blue intensity of &H16, plus a change in Green intensity of &HE3 plus a Red change of &H60.
So a single change in the Blue value overpowers any of the other colour changes....
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
hey all! thanks for your replies! In the meantime I developed some C++ dll which does the job. in order to overcome the problem as described with blue values, I have the dll first change the difference image (XORed images)into greyscales, and then check these values. Please check my website to see the program I am working on, which uses this dll. The trial version of the program is not the final one I have now, but I cannot ftp the newest version from this PC.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.