home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
demo
/
wit4711
/
lib
/
help
/
morpho
/
berode.
/
berode.bin
Wrap
Text File
|
1995-12-09
|
4KB
|
91 lines
OPERATOR
berode --- binary erosion
DESCRIPTION
The berode operator performs a morphological erosion on the input image.
Contiguous white areas in the image are considered objects and the background
is assumed to be black. Erosion separates objects that are touching and
removes isolated pixels. The kernel parameter allows the user to specify a
structuring element which will control the erosion. The center of the kernel
is always in row ( kernelHeight / 2) and column ( kernelWidth / 2). The
operation of erosion is such that for every pixel p in the input image, if
every 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. Otherwise, it will be cleared. 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 every combination input pixel is set and its
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 0 1 0 0 0
0 1 1 1 0 0 1 1 0 0
0 0 1 1 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0
2) Kernel: 1 1 0 Output: 0 0 0 0 0
0 0 1 0 0
0 0 1 1 0
0 0 0 1 0
0 0 0 0 0
3) Kernel: 1 1 Output: 0 0 0 0 0
1 0 0 1 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
In the first example, the output is only reduced on the right side of the
input object because the kernel, when aligned with any input pixel, will set
the output only if both the pixel corresponding to the kernel center is set
and if the pixel one to the right of that input pixel is set. In a
similar fashion, the second example reduces the object on the left side. 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 reduced to only
two pixels because only two set pixels in the input object have neighbours
below and to the right which are both set. All other pixels are cleared.
The default kernel for berode is a 3 by 3 kernel where every bit is set.
This will tend to reduce all regions within the input and also eliminate all
isolated pixels.
The implementation of erosion 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 non-zero value. Note that when the
center of the kernel is zero, it is possible for erosion to set an output
pixel even if the input pixel is zero.
Given a binary image I, the following identities hold for bdilate , berode and
gerode:
berode(I) = inverse(bdilate(inverse(I)))
bdilate(I) = inverse(berode(inverse(I)))
gerode(I) = berode(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 berode and gerode:
threshold(gerode(I)) = berode(threshold(I))