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

Your email address will not be published. Required fields are marked *

five × 4 =