-
Image Recognition
I am writing an application that takes snapshot images!
I would like to be able to call a function that will take any two images and give me an indicator that they have changed.
Basically a diff type function that would return a number indicating the threshold of the change.
ie. lDiff = jpregcompare(IMAGE1,IMAGE2) returns long;
lDiff would get some kind of number that I could use to determine weather or not the image changed enough for me to take action.
ie. video surveillance, turn on VCR, turn on Lights, ...etc
Anyone got any code or controls that will let you mess around like this????
-
A simple way would be to just loop through each pixel, and log when any are different. Then if this is a large enough number then count it as a change.
The more complicated way would be to, having logged a change, calculate how different it is, then decide based on that as well.
-
alright I am sure this is not the best way, but some way to go
you can invert the first picture and than draw the other one with paintpicture (BitBlt would do it too) with the operator vbSrcInvert onto the first one. Now you could look for any pixels not black and count them this will give you the total number of changed pixels.
-
However, since you are using JPEG and a video source, it will have a lot of different pictures because of compression and graininess. You better be careful with that method, rather than judging how many pixels changed, judge how much the pixels changed by.
-
true true I did not read through the post properly...
maybe the convolution thing would help you... (just a guess, not an answer to your problem) you could find some sample on that on www.ur.co.nz