Image Processing Toolbox | ![]() ![]() |
Eroding an Image
To erode an image, use the imerode
function. The imerode
function accepts two primary arguments:
strel
function, or a binary matrix defining the neighborhood of a structuring element
imerode
also accepts three optional arguments: PADOPT
, PACKOPT
, and M
.
The PADOPT
argument affects the size of the output image. The PACKOPT
argument identifies the input image as packed binary. If the image is packed binary, M
identifies the number of rows in the original image. (See the bwpack
reference page for more information about binary image packing.)
The following example erodes the binary image, circbw.tif
:
strel
function, see Structuring Elements.)
SE = strel('arbitrary',eye(5)); SE= Flat STREL object containing 5 neighbors. Neighborhood: 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
imerode
function, passing the image, BW
, and the structuring element, SE
, as arguments.
Figure 9-4: Circbw.tif Before and After Erosion with a Diagonal Structuring Element
![]() | Dilating an Image | Combining Dilation and Erosion | ![]() |