Image Processing Toolbox | ![]() ![]() |
Selecting a Polygon
You can use the roipoly
function to specify a polygonal region of interest. If you call roipoly
with no input arguments, the cursor changes to a cross hair when it is over the image displayed in the current axes. You can then specify the vertices of the polygon by clicking on points in the image with the mouse. When you are done selecting vertices, press Return; roipoly
returns a binary image of the same size as the input image, containing 1's inside the specified polygon, and 0's everywhere else.
The example below illustrates using the interactive syntax of roipoly to create a binary mask. The border of the selected region in Figure 11-1, which was created using a mouse, is shown in red.
Figure 11-1: A Polygonal Region of Interest Selected Using roipoly
Figure 11-2: A Binary Mask Created for the Region Shown in Figure 11-1.
You can also use roipoly
noninteractively. See the reference page for roipoly
for more information.
![]() | Specifying a Region of Interest | Other Selection Methods | ![]() |