You are currently viewing How to Identify Circle in a Image using MATLAB

How to Identify Circle in a Image using MATLAB

Spread the love

 

Read the input Image

I = imread('circlesBrightDark.png');
          imshow(I)
          Rmin = 30;
          Rmax = 65;

Find all the bright circles

          % Find all the bright circles in the image
          [centersBright, radiiBright] = imfindcircles(I,[Rmin Rmax], ...
                                        'ObjectPolarity','bright');

Find the dark circles

          % Find all the dark circles in the image
          [centersDark, radiiDark] = imfindcircles(I, [Rmin Rmax], ...
                                        'ObjectPolarity','dark');

Plotting the bright circles

          % Plot bright circles in blue
          viscircles(centersBright, radiiBright,'EdgeColor','b');

Plotting the dark circles

          % Plot dark circles in dashed red boundaries
          viscircles(centersDark, radiiDark,'LineStyle','--');

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.