Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two picture boxes

Status
Not open for further replies.

middelbh

Technical User
Feb 19, 2003
4
NL
Hello

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?

Hans
 
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
 
Thanks Russell,

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.

Hans
 
I konw this is late, but I also would like to implement motion detection?

Did you get it right then?

I do not kow the first thing about comparing or working with images, any help will be greatly appreciated

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
>motion detection?
>I do not kow the first thing about comparing or working with images

You just might be trying to run before you can walk...
 
But AHA....

I got it working, will post my solution shortly.

Nothing wrong with being a fast learner...

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
It's actually very simple...

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)
 
Fair enough, but

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

 
So, then....

Please enlighten me as to how the pro's do it, this was merely my first try at it, and I think it works well under the circumstances.

Any ideas

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
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?'
 
What you say may be perfectly right...

Fact of the matter, it works like a bomb...
Untill I get to work on something better, this will do just fine for me.

P.S. I''ve been using it lately to &quot;check out my house&quot; and it works like a bomb

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
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.
is the place to go!

regards

Hans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top