Main Content

Calculate Properties of Image Regions Using Image Region Analyzer

This example shows how to calculate the properties of regions in binary images by using the Image Region Analyzer app. This example finds the largest region, measured by area, in the image.

Read a binary image into the workspace.

BW = imread("text.png");

Open the image in the Image Region Analyzer app by using the imageRegionAnalyzer function.


The Image Region Analyzer app displays the binary image and a table with region properties. In the table, each row is a region identified in the image and each column is a property of that region, such as the area, perimeter, and orientation.

Binary region displayed in the Analyze Regions tab on the right, and a table with region properties on the left.

To access the image exploration controls such as pan and zoom, move the cursor over the image.

Pan, zoom in, zoom out, and reset controls.

The app initially displays a subset of the available properties. To add or remove properties from the table, click Choose Properties and select the properties you want to view. The app updates the table automatically.

Expanded view of the Choose Properties dropdown menu, with the Circularity property deselected.

Initially, the app lists the regions in the order it finds them, starting in the upper-left corner of the image. To change the sorting order, click the sort icon next to a property name in the table. The app sorts the regions in increasing order. Click again to sort the regions in decreasing order.

For example, to sort the regions in the image from largest area to smallest area, click on the sort icon for the Area property twice.

Rows in the table are sorted by area from largest to smallest. The app highlights all regions in the binary image in red.

To view the region in the image with the largest area, click the first row in the table. The app highlights the corresponding region in the image.

The row in the table with the largest area is selected. The app highlights the corresponding region in the binary image in red.

See Also

| | |

Related Topics