Specifications
Morphological Operations
8-5
8
NOTE. All source image attributes are defined in the image header
pointed to by
srcImage.
Dilate
Dilates the image.
void iplDilate(IplImage*
srcImage
, IplImage*
dstImage
, int
nIterations
);
srcImage
Thesourceimage.
dstImage
The resultant image.
nIterations
The number of times to dilate the image.
Discussion
The function iplDilate() performs a dilation of the image
nIterations
times. The way the image is dilated depends on whether the image is
binary, gray-scale, or a color image.
• For a binary input image, the output pixel is set to 1 if the corresponding
input pixel is 1 or any of 8 neighboring input pixels is 1.
• For a gray-scale image, the output pixel is set to the maximum of the
corresponding input pixel and its 8 neighboring pixels.
• For a color image, each color channel in the output pixel is set to the
maximum of this channel’s values at the corresponding input pixel and
its 8 neighboring pixels.
The effect of dilation is to fill up holes and to thicken boundaries of objects
on a dark background (that is, objects whose pixel values are greater than
those of the background).