home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
demo
/
wit4711
/
lib
/
help
/
morpho
/
bdilate.
/
bdilate.bin
Wrap
Text File
|
1995-12-09
|
4KB
|
89 lines
OPERATOR
bdilate --- binary dilation
DESCRIPTION
The bdilate operator performs a morphological dilation on the input image.
Contiguous white areas in the image are considered objects and the background
is assumed to be black. Dilation connects discontinous objects and fills in
holes. The kernel parameter allows the user to specify a structuring element
which will control the dilation. The center of the kernel is always in row
( kernelHeight / 2) and column ( kernelWidth / 2). The operation of dilation
is such that for every pixel p in the input image, if any pixel in the
neighbourhood of p , as defined by the kernel dimensions, is on and the
corresponding entry in the kernel is also on, then the output pixel
corresponding to p will be set. In other words, the kernel defines a mask
which is layed over the input image with its center aligned on a pixel at
row r and column c . The output pixel at r and c will be set if any input
pixel is set and the corresponding bit in the kernel mask is also set. For
example,
1) Input: 0 0 0 0 0 Kernel: 0 1 1 Output: 0 0 0 0 0
0 1 1 0 0 1 1 1 0 0
0 1 1 1 0 1 1 1 1 0
0 0 1 1 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0
2) Kernel: 1 1 0 Output: 0 0 0 0 0
0 1 1 1 0
0 1 1 1 1
0 0 1 1 1
0 0 0 0 0
3) Kernel: 1 1 Output: 0 1 1 0 0
1 0 1 1 1 1 0
1 1 1 1 0
0 1 1 1 0
0 0 0 0 0
In the first example, the output is only grown to the left of the input
object because the kernel, when aligned with any input pixel, will set the
output only if either the pixel corresponding to kernel center is set, or
the pixel one to the right of that input pixel is set. In a similar
fashion, the second example grows the object to the right. The third example
uses a kernel of size 2x2, with its center, being the top left bit in the
kernel. The resulting output object has been grown to the left and top of
the input object. The default kernel for bdilate is a 3 by 3 kernel where
every bit is set. This will tend to expand all regions within the input and
also fill all holes within those regions.
The implementation of dilation used in WiT is defined in the paper by
Haralick, Sternberg and Zhuang, IEEE Transactions on Pattern Analysis and
Machine Intelligence, July 1987. Border conditions are handled by assuming all
pixels outside of the input image have zero value. Note that when the center
of the kernel is zero, it is possible for dilation to clear an output pixel
even if the input pixel is set.
Given a binary image I, the following identities hold for bdilate , berode and
gdilate:
berode(I) = inverse(bdilate(inverse(I)))
bdilate(I) = inverse(berode(inverse(I)))
gdilate(I) = bdilate(I)
In other words, erosion of the foreground of I is the same as dilating the
background of I and vice versa.
Given a grayscale image I, the following identity holds for bdilate and
gdilate:
threshold(gdilate(I)) = bdilate(threshold(I))