Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Abstract—This paper presents an edge detection method based on mathematical morphology. The proposed
scheme consists of four steps: preprocessing, edge extraction, edge decision, and postprocessing. In the prepro-
cessing step, a morphological central transformation is applied to remove noise. In the edge extraction and deci-
sion steps, a morphological edge extractor is designed to estimate the edge information of an image, and an
edge decision criterion is followed to determine whether a pixel is an edge or not. In the postprocessing step,
the morphological hit-or-miss transformation is utilized to improve the correctness of the detected edges. It is
proved theoretically for the correctness and effectiveness for detecting ideal edges. Experimental results show
that the proposed method works well on both artificial and real images.
DOI: 10.1134/S1054661806030102
ISSN 1054-6618, Pattern Recognition and Image Analysis, 2006, Vol. 16, No. 3, pp. 406–412. © Pleiades Publishing, Inc., 2006.
AN INTEGRATED EDGE DETECTION METHOD USING MATHEMATICAL MORPHOLOGY 407
Morphological operators are nonlinear; they are not [3]. These properties show the validity of the CT for the
only very effective for detecting edges but also well signal smoothing.
suited for efficient implementation using parallel or To compare with the linear smoothing (LS) operator
sequential computing [5]. The proposed method is shown in Eq. (4) used in many edge detection algo-
shown to be theoretically effective for ideal edges. rithms [2, 16],
Experimental results are provided to show the validity
( N – 1 )/2
and performance of our method in practice for artificial
∑
1
and real images. LS ( f ( n ) ) = ---- f ( n – j ), (4)
N
j = – ( N – 1 )/2
2. THE PROPOSED METHOD where N (odd, positive integer) is the number of pixels
of the mask and the median smoothing (MD) operator
The proposed edge detection method consists of the is constructed by replacing the value of each point with
following four steps: (1) preprocessing, (2) edge extrac- the median value in the masked neighborhood of that
tion, (3) edge decision, and (4) postprocessing. The point. The CT method is a better choice for noise
purpose of the preprocessing step is to remove noise removal in edge detection applications due to the fol-
from an image in order to enhance the validity of the lowing observations: (1) Using LS, sharp edges are
subsequent edge detection process. A morphological widened. However, using the CT and MD, sharp edges
edge extractor is proposed to evaluate the edge infor- are preserved. (2) The CT method smoothes out more
mation of an image, and the morphological decision than LS or MD. (3) In the noisy case, the CT and MD
step is applied to decide whether or not edges are remove all the noise, while the LS cannot. These obser-
present. In the postprocessing step, a morphological vations indicate that the morphological filter is a better
hit-or-miss transformation is designed to remove extra- choice for signal smoothing than the linear or median
neous noisy edges. Details of each step are presented in smoothing.
the following subsections.
2.2. Edge Extraction
2.1. Preprocessing
In this section, an effective edge extraction scheme
A good edge detection algorithm should not only be based on the morphological transformation is proposed
capable of detecting the edge information but also be and its validity is investigated. The edge extraction
insensitive to noise. A morphological transformation is operator is defined as follows:
proposed here to remove noise while keeping the edge
information. In order to deal with both positive and f ed
(5)
negative noise, we combine the positive and negative = Max { LS ( f ( n ) ) – f ( n ) , Min { e r ( n ), d r ( n ) } },
morphological smoothing filters to form the morpho-
logical central transformation (CT). The central trans- where fed is the extracted edge information, f is an input
formation is derived from the combination of morpho- signal such as an image, and LS(.) is the linear operator
logical opening-closing and morphological closing- defined in Eq. (4). The size of the linear smoothing
opening filters to obtain the central area of the signal, mask is the same as the size of the structuring function
that is, used in the erosion and dilation residues. The erosion
residue er is defined as
CT ( f ( n ) )
(1) e r = f – ( fΘk ), (6)
= Min { oc ( f ( n ) ), Max { co ( f ( n ) ), f ( n ) } },
where co( f (n)) is the morphological opening operation where k is a structuring function with a flat top and zero
followed by the morphological closing operation height, f is the input signal, and Θ is the morphological
applied to signal f (n) and the oc( f (n)) is the morpholog- erosion operator. The dilation residue dr is defined as
ical closing operation followed by the morphological dr = ( f ⊕ k ) – f , (7)
opening operation applied to signal f (n). The central
transformation has the following important properties:. where f and k are the same as in the erosion residue and
Property 1. The CT( f (n)) is bounded to co( f (n)) ⊕ is the morphological dilation operator. We list some
and oc( f (n)), that is, properties of the proposed edge extraction operator to
support the validity of the operator.
co ( f ( n ) ) ≤ CT ( f ( n ) ) ≤ oc ( f ( n ) ). (2) Property 3. If input signal f (n) is constant over the
Property 2. The CT filter is an idempotent filter, that size of the mask (or support K of the structuring func-
is, tion) and the structuring function has a flat top with
zero height, then the extracted edge information
CT ( CT ( f ( n ) ) ) = CT ( f ( n ) ). (3) fed(n) = 0.
These properties can be proved using the antiextensive, Proof: By definition, fed = Max{|LS( f (n)) – f (n)|,
extensive, and idempotent properties of co and oc filters Min{er(n), dr(n)}}. If f (n) is constant over the mask
Fig. 1. Artificial test images: (a) the clean image, (b) the noisy version with SNR 10dB, (c) the noisy version with SNR 7dB.
Let f(n) = r(n). Then, LSr(r(n)) = |LS(r(n)) – r(n)| ≥ 2.3. Edge Decision
0, ∀n. If LSr(r(nm)) > 0, then fed(nm) > 0 holds. If
LSr(r(nm)) = 0, then we need to show Min[er(nm), In addition to the edge information, the image con-
dr(nm)]] > 0 first, then we can get fed(nm) > 0. tains many spurious pixels, illustrating the problem
associated with thresholding the edge information. The
By definition, r(n) = C if n ≥ ni, C(n – n0)/(ni – n0) if simplest thresholding technique would be to select a
n0 < n < ni, 0 otherwise. single value Th and assign all pixels with an edge
We have r(nm) = C(nm – n0)/(N – n0) > 0, er(nm) = strength above the selected value Th to the set of edge
r(nm) – Minj ∈ Kr(nm + j) > 0, and dr(nm) = Maxj ∈ Kr(nm – pixel. But in real image it seems hard to select a single
j) – r(nm) > 0, where K is the support of the structuring threshold value that will extract the edge without spuri-
function. We get Min[er(nm), dr(nm)]] > 0. ous noise.
This property confirms that our edge extractor In order to solve this problem, we apply a morpho-
detects the middle point of the ramp edge. logical operator Rm to the extracted edge first and then
thresholding to get a binary signal. The morphological The property can be shown easily by using the anti-
operator Rm is defined as extensive property of the oc filter. The advantage of this
R m ( n ) = f ed ( n ) – Min [ oc ( f ed ( n ) ), f ed ( n ) ], (19) operator is not only that it can be used to select the
peaks of interest but also that it is above most of the tex-
where fed denotes the extracted edge information image, ture. Thus, this operator can be used for prethreshold-
oc is the opening–closing operation, and Min[x] ing purposes. The width of the structuring function
denotes the minimum of x. used in this stage should not be more than that used in
Property 7. Rm(n) is a nonnegative value for all n. the edge extraction. Then, to determine the edge pixel
in the image, just set a single threshold value Th is nec- 6, respectively. Figure 6 indicates that some thin edges
essary. The thresholding is are lost and the detected edges appear fuzzy when using
the blur-minimum based method. Figure 5 shows that
⎧ C if R m > Th, the proposed method successfully detects the edges of
F = ⎨ (20) the test images. The results indicate that the proposed
⎩ 0 otherwise, algorithm is effective in the edge detection of complex
where F is a binary signal or image, C is a fixed con- images. A visual evaluation gives the impression that
stant (C > 0), for the binary image case C = 1, Rm is the the proposed algorithm has a better performance in the
test images.
morphological operation signal, and Th is set to a small
constant.
4. CONCLUSIONS
2.4. Postprocessing In this paper, the problem of edge detection using a
Although the edge can theoretically be correctly morphological approach has been studied. Existing
detected, in practice the resulting edge image will have methods for edge detection emphasize the edge extrac-
some broken and isolated edge pixels. If we assumed tion only. In this paper, we use morphological
edges are connected and not isolated, then some kind of approaches to solve the edge detection problem with a
noise removal and edge growing is required to improve more complete and robust solution. We show theoreti-
the quality. This procedure can be efficiently performed cally the correctness and effectiveness for the proposed
using morphological operators. Since the image in this method in manipulating ideal edges. Experimental
step is already a binary image, the morphological oper- results are also provided to show the validity and high
ator is also binary. The hit-or-miss transformation [9] is performance of our method in practice for artificial and
proposed to remove the spurious noise and to grow bro- real images.
ken edges by designing proper structuring element
pairs.
REFERENCES
The hit-or-miss transformation is defined as
1. A. Kundu and S. K. Mitra, “A New Algorithm for Image
F ⊗ S ( n ) = ( FΘA ) ∩ ( F ΘB ),
c
(21) Edge Extraction, a Statistical Classifier Approach,”
IEEE Trans. on Pattern Analysis and Machine Intelli-
where F is a binary image, S is a structuring element gence 9, 569–577 (1987).
pair S = (A, B) (one to probe the inside and one to probe
2. J. Lee, R. Haralick, and L. Shapiro, “Morphological
the outside of F), Fc is the complement of F, and ∩ is a Edge Detection,” IEEE J. of Robotics and Automation 3,
logical AND operator. It is assumed that A and B are 142–155 (1987).
disjoint, or otherwise it is impossible for both fits to
3. J. R. Hidalgo and P. Salembier, “Robust Segmentation
occur simultaneously. Since the hit-or-miss transforma- and Representation of Foreground Key Regions in Video
tion is a pattern-matching process, so it can be used to Sequences,” Proc. IEEE ICASSP 3, 1565–1568 (2001).
locate the desired pattern for removal or recovery.
4. J. Serra, Image Analysis and Mathematical Morphology
(Academic Press Inc., 1982).
3. EXPERIMENTAL RESULTS 5. J. Serra, “Introduction to Mathematical Morphology,”
In this section, two experiments are conducted to Computer Vision, Graphics, and Image Processing 35,
test the validity of the proposed method. A structuring 283–305 (1986).
function of dimensions 3 × 3 with a flat top and zero 6. K. Cinkler, “Very Low Bit-Rate Wavelet Video Coding,”
height is used in the experiments. In the first test, an IEEE J. on Selected Areas in Communications 16, 4–11
artificial checkerboard image and two of its noisy ver- (1998).
sions shown in Fig. 1 are selected to test the algorithm. 7. J. Canny, “A Computational Approach to Edge Detec-
Figures 1b and 1c show added Gaussian noise to Fig. 1a tion,” IEEE Trans. on Pattern Analysis and Machine
with a signal-to-noise ratio (SNR) of 10.0 and 7.0 dB, Intelligence 8, 6979–6986 (1986).
respectively. The edge detection results of the proposed 8. P. Maragos, “Morphological Filter-Part I,” IEEE Trans.
algorithm and the blur-minimum method [2] are shown on Acoustics, Speech, and Signal Processing 35, 1153–
in Figs. 2 and 3, respectively. These results indicate that 1169 (1987).
the visual quality of these two methods in the “clean” 9. P. Maragos, “Morphological Filter-Part II,” IEEE Trans.
artificial images is almost the same. However, the edge on Acoustics, Speech, and Signal Processing 35, 1170–
detection results using the proposed method are more 1184 (1987).
insensitive to noise. 10. P. Salembier and J. Serra, “Morphological Multiscale
In the second test, we apply the algorithm to popular Image Segmentation,” SPIE-VCIP 1818, 620–631
real test images of Lena and House, shown in Fig. 4. (1992).
The edge detection results using the proposed method 11. R. C. Gozalez and E. W. Richard, Digital Image Process-
and the blur-minimum method are shown in Figs. 5 and ing (Prentice-Hall Inc., 2002).
12. S. R. Sternberg, “Grayscale Morphology,” Computer Trans. on Pattern Analysis, and Machine Intelligence 9,
Vision, Graphics, and Image Processing 35, 333–355 532–550 (1987).
(1986).
15. T. Meier and K. N. Ngan, “Video Segmentation for Con-
13. S. Mallat and S. Zhong, “Characterization of Signals
tent-Based Coding,” IEEE Trans. on Circuit and Systems
from Multiscale Edges,” IEEE Trans. on Pattern Analy-
for Video Technology 9, 1190–1203 (1999).
sis, and Machine Intelligence 14, 701–732 (1992).
14. S. Sternberg, R. Haralick, and X. Zhuuang, “Image 16. Y. Yakimovsky, “Boundary and Detection in Real World
Analysis Using Mathematical Morphology,” IEEE Image,” J. of ACM 23, 599–618 (1976).