C# AForge not detecting colored circle

1k views Asked by At

I'm trying to detect colored circles in a MCQ form, It's detecting the blank circles and the colored ones as long as the color fits inside the circle, once the color is outside, it doesnt detect the circle anymore! Plz help.! I'm applying these filters:

        FiltersSequence seq = new FiltersSequence();
        seq.Add(Grayscale.CommonAlgorithms.BT709);  //First add  grayScaling filter
        seq.Add(new OtsuThreshold()); //Then add binarization(thresholding) filter
        temp = seq.Apply(source); // Apply filters on source image

Then going through the Blob detection and isCircle function, so as the image shows, it detects all circles(blank or colored) as long as the color fits inside the circle, how can I fix that to make it detect every single circle?

https://i.stack.imgur.com/Te8mZ.png

1

There are 1 answers

0
chefjuanpi On

In your png isn't all times circles, depends how the people write, it's not a good idea search circles.

My idea is use a color filtering to discard the red color (the empty circles) and other filtre to eliminate the lines and numbers, maybe with OtsuThreshold you obtain that, an image with black background and only the colored circles.

i make a test with your image,

1) hslfilter hue min 222 max 277, sat 0.204, 0.675; lum 0.000, 0.706

2) grayscale

3) treshold 12

4) bolbs filtering samll w h to 5

5) conect components to showing every blob with colors (only for view how detect the blobs).

Voila:

Example detection blobs

In the result image all blobs are positive reponses

for test the filter sequense use the image processing lab from aforge http://www.aforgenet.com/projects/iplab/downloads.html

If you need know if the answer is a b c or d the process are rezise the image to obtain a size standard for every picture. and read the position properties (X,Y) of every blob to obtain if is 1D or 64C.

maybe is more easy to read

List aswers = use a rectangle and cut every column (a,b,c,d).

in this list detect the x porperty for the blobs to detect the number with positive reponse