Image Processing Toolbox User's Guide Previous page   Next Page

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 crosshairs when it is over the image displayed in the current axes. You can then specify the vertices of the polygon by clicking 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. In the figure, the border of the selected region that was created using a mouse is shown in red.

Polygonal Region of Interest Selected Using roipoly

Binary Mask Created for the Region Shown in the Preceding Figure

You can also use roipoly noninteractively. See the reference page for roipoly for more information.


Previous page  Specifying a Region of Interest Other Selection Methods Next page

© 1994-2005 The MathWorks, Inc.