This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Segmentation Using Find Circles in Image Segmenter

This example shows how to use the Find Circles option in the Image Segmenter app to segment an image. The Find Circles option is an automatic segmentation technique that you can use to segment an image into foreground and background elements. The Find Circles option does not require initialization.

Read an image into the MATLAB® workspace and load it into the Image Segmenter app. For more information about opening the Image Segmenter app and loading an image, see Open Image Segmenter App and Load Image.

coins = imread('coins.png');
imageSegmenter(coins)

Expand the Create Mask toolstrip group and click Find Circles. The Image Segmenter opens the Find Circles tab.

In the Find Circles tab, first click Ruler and measure the diameters of circles in the image to determine the range of sizes. To find circles, you must specify the lower and upper bounds on the diameters. Set the values in the Min. Diameter and Max. Diameter fields to values that you think include all the objects, 50 and 150.

Click Run. The Image Segmenter fills the circles it finds. However, find circles does not find two of the circles. Examining the diameter of the objects not found, you can see that their diameter is slightly less than the specified minimum diameter.

Change the minimum value to accommodate the sizes of the objects that were not segmented and click Run again. This time, Find Circles segments all the objects in the image.

When you are satisfied with the segmentation, click Create Mask to create the mask image. The Image Segmenter creates the segmentation, changing the color of the segmented part of the image from blue to yellow, and closes the Find Circles tab. To view the mask image, click Show Binary.

When you are done segmenting the image, you can save the binary mask, using the Export option. You can also obtain the code used for the segmentation. For more information about saving the mask image, see Save Mask Image Created Using Image Segmenter.

See Also

|

Related Topics