Main Content

Use Texture Filtering in Image Segmenter

This example shows how to use the Include Texture Features option in the Image Segmenter app to segment an image.

When using the Auto Cluster, Graph Cut, and Flood Fill segmentation tools, you can also include texture as an additional consideration in your segmentation by selecting the Include Texture Features option. Texture filtering can help distinguish the foreground in an image from the background. When you select Include Texture Features, Image Segmenter uses Gabor filters to analyze the texture of the image as a preprocessing step for segmentation. For more information about Gabor filters, see Texture Segmentation Using Gabor Filters.

Load Image into Image Segmenter App

Read an image into the workspace.

img = imread("kobi.png");

Open the Image Segmenter app, and load the image into the app. On the Apps tab of the MATLAB® Toolstrip, in the Apps section, select Image Segmenter . Then, on the app toolstrip, select Load Image, and then select Load Image From Workspace. In the Import From Workspace dialog box, select the image img you read into the workspace. Image Segmenter displays the selected image.

Image loaded in Image Segmenter

You can also open the app and immediately load the image into it by entering this command in the Command Window:


Use Auto Cluster to Segment Image

On the Image Segmenter toolstrip, expand the Segmentation Tools section, select Auto Cluster. Image Segmenter automatically segments the image, displaying the result. The Auto Cluster option correctly segments the body of the dog as the foreground, but incorrectly segments the eyes and part of the nose of the dog as parts of the background.

Partially incorrect segmentation using Auto Cluster

Include Texture Features in Segmentation

On the Image Segmenter toolstrip, select New Segmentation. Select Include Texture Features and, once Image Segmenter finishes applying the Gabor filters, select Auto Cluster again. By including the texture features, Image Segmenter correctly segments the entire dog as the foreground.

Correct segmentation after including texture features with Auto Cluster

See Also

Related Topics