Image Processing Toolbox User's Guide Previous page   Next Page

Filling a Region

Filling is a process that fills a region of interest by interpolating the pixel values from the borders of the region. This process can be used to make objects in an image seem to disappear as they are replaced with values that blend in with the background area.

To fill a region of interest, you can use the roifill function. This function is useful for image editing, including removal of extraneous details or artifacts.

roifill performs the fill operation using an interpolation method based on Laplace's equation. This method results in the smoothest possible fill, given the values on the boundary of the region.

As with roipoly, you select the region of interest with the mouse. When you complete the selection, roifill returns an image with the selected region filled in.

This example shows how to use roifill to fill a region in an image.

  1. Read an image into the MATLAB workspace and display it. Because the image is an indexed image, the example uses ind2gray to convert it to a grayscale image.
  2. Call roifill and then use the mouse to select the region you want to fill (shown in red in the following figure). roifill returns the modified image in I2.
  3. Display the modified image. Note how the region of interest defined in the previous step has been filled.


Previous page  Filtering a Region Image Deblurring Next page

© 1994-2005 The MathWorks, Inc.