### Issue detecting multiple circles in black background

Posted:

**Tue Feb 20, 2018 5:29 am**Hello! I have project where I am trying to detect the circles in a black and white image. I invert the image and use the BlobCpunter :

The image looks like this after it is inverted:

I have tried several different values for blobCounter.MinHeight and MinWidth. When it is small, like 2, it picks up artifacts. Larger values never seem to pick up the circles with the index numbers in them. I want to count the number of circles with the index numbers in them. I am new to AForge, so I am not sure what I am doing wrong.

Any help is appreciated!

Thanks

- Code: Select all
`// create filter`

Invert filter = new Invert();

// apply the filter

filter.ApplyInPlace(bitmapData);

// step 2 - locating objects

BlobCounter blobCounter = new BlobCounter();

blobCounter.FilterBlobs = true;

blobCounter.MinHeight = 2;

blobCounter.MinWidth = 2;

blobCounter.ProcessImage(bitmapData);

Blob[] blobs = blobCounter.GetObjectsInformation();

bitmap.UnlockBits(bitmapData);

The image looks like this after it is inverted:

I have tried several different values for blobCounter.MinHeight and MinWidth. When it is small, like 2, it picks up artifacts. Larger values never seem to pick up the circles with the index numbers in them. I want to count the number of circles with the index numbers in them. I am new to AForge, so I am not sure what I am doing wrong.

Any help is appreciated!

Thanks