Image Processing Toolbox User's Guide Previous page   Next Page
roifill

Smoothly interpolate within an arbitrary image region

Syntax

Description

roifill fills in a specified polygon in an intensity image. It smoothly interpolates inward from the pixel values on the boundary of the polygon by solving Laplace's equation. roifill can be used, for example, to erase small objects in an image.

J = roifill(I,c,r) fills in the polygon specified by c and r, which are equal-length vectors containing the row-column coordinates of the pixels on vertices of the polygon. The kth vertex is the pixel (r(k),c(k)).

J = roifill(I) displays the image I on the screen and lets you specify the polygon using the mouse. If you omit I, roifill operates on the image in the current axes. Use normal button clicks to add vertices to the polygon. Pressing Backspace or Delete removes the previously selected vertex. A shift-click, right-click, or double-click adds a final vertex to the selection and then starts the fill; pressing Return finishes the selection without adding a vertex.

J = roifill(I,BW) uses BW (a binary image the same size as I) as a mask. roifill fills in the regions in I corresponding to the nonzero pixels in BW. If there are multiple regions, roifill performs the interpolation on each region independently.

[J,BW] = roifill(...) returns the binary mask used to determine which pixels in I get filled. BW is a binary image the same size as I with 1's for pixels corresponding to the interpolated region of I and 0's elsewhere.

J = roifill(x,y,I,xi,yi) uses the vectors x and y to establish a nondefault spatial coordinate system. xi and yi are equal-length vectors that specify polygon vertices as locations in this coordinate system.

[x,y,J,BW,xi,yi] = roifill(...) returns the XData and YData in x and y, the output image in J, the mask image in BW, and the polygon coordinates in xi and yi. xi and yi are empty if the roifill(I,BW) form is used.

If roifill is called with no output arguments, the resulting image is displayed in a new figure.

Class Support

The input image I can of class uint8, uint16, int16, single, or double. The input binary mask BW can be any numeric class or logical. The output binary mask BW is always logical. The output image J is of the same class as I. All other inputs and outputs are of class double.

Example

See Also

roifilt2, roipoly


Previous page  roicolor roifilt2 Next page

© 1994-2005 The MathWorks, Inc.