AForge.net - BlobCounter get different "zones" between 2 images

403 Views Asked by At

I'm trying to write something that will accept 2 images and will return an array (or some kind of collection), and each element represent a difference between the images.

For example if I have a photo of a background and a man standing on the right in the source image, and than the same photo but the difference from the first photo is that the man is standing on the left than I will have a collection of 1 returned to me with XY coordinates where the change starts and a Width and Height of the change.

I found that AForge has a BlobCounter class for such purpose but couldn't understand exactly what I'm supposed to give it - In the example (http://www.aforgenet.com/framework/docs/html/d7d5c028-7a23-e27d-ffd0-5df57cbd31a6.htm) in the documentation I see only processing of one image - but not the comparison. I couldn't find a better example.

What am I missing here (I'm new to image processing).

1

There are 1 best solutions below

0
On BEST ANSWER

Found the solution thanks to a post here: Aforge Blob Detection along with BlobCounters

here's my solution:

// create filter
ThresholdedDifference filter = new ThresholdedDifference(60);
// apply the filter
filter.OverlayImage = currentImg;
Bitmap resultImage = filter.Apply(_lastImg);

// create an instance of blob counter algorithm
BlobCounter bc = new BlobCounter();
// process binary image
bc.ProcessImage(resultImage);
Rectangle[] rects = bc.GetObjectsRectangles();
// process blobs
foreach (Rectangle rect in rects)
{
    string a = String.Empty;
}