Detection of Discontinuities
•Therearethreekindsofdiscontinuitiesofintensity:points,
linesandedges.
•Themostcommonwaytolookfordiscontinuitiesistoscana
smallmaskovertheimage.Themaskdetermineswhichkind
ofdiscontinuitytolookfor.
9
1
992211
...
i
ii
zwzwzwzwR
Detection of Discontinuities
Point Detection thresholdenonnegativ a: whereT
TR
Detection of Discontinuities
Line Detection
•Onlyslightlymorecommonthanpointdetectionistofinda
onepixelwidelineinanimage.
•Fordigitalimagestheonlythreepointstraightlinesareonly
horizontal,vertical,ordiagonal(+or–45).
Detection of Discontinuities
Line Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Edge Detection
Detection of Discontinuities
Gradient Operators
•First-order derivatives:
–The gradient of an image f(x,y) at location (x,y) is defined
as the vector:
–The magnitudeof this vector:
–The directionof this vector:
y
f
x
f
y
x
G
G
f
2
1
22
)(mag
yx
GGf f
x
y
G
G
yx
1
tan),(
Detection of Discontinuities
Gradient Operators
Roberts cross-gradient operators
Prewitt operators
Sobel operators
Detection of Discontinuities
Gradient Operators
Prewitt masks for
detecting diagonal edges
Sobel masks for
detecting diagonal edges
yxGGf Detection of Discontinuities
Gradient Operators: Example
Detection of Discontinuities
Gradient Operators: Example
Detection of Discontinuities
Gradient Operators: Example
Detection of Discontinuities
Gradient Operators
•Second-order derivatives: (The Laplacian)
–The Laplacian of an 2D function f(x,y) is defined as
–Two forms in practice:2
2
2
2
2
y
f
x
f
f
Detection of Discontinuities
Gradient Operators
•Consider the function:
•The Laplacian of his
•The Laplacian of a Gaussian sometimes is called the Mexican
hat function. It also can be computed bysmoothing the image
with the Gaussian smoothing mask, followed by application of
the Laplacian mask.deviation standard the: and
where)(
2222
2
2
yxrerh
r
2
2
2
4
22
2
)(
r
e
r
rh
The Laplacian of a
Gaussian (LoG)
A Gaussian function
Detection of Discontinuities
Gradient Operators
Detection of Discontinuities
Gradient Operators: Example
Sobel gradient
Laplacian maskGaussian smooth function
Detection of Discontinuities
Gradient Operators: Example
Edge Linking and Boundary Detection
Local Processing: Algorithm
1.Computethegradientmagnitudeandanglearrays,M(x,y)andα(x,
y),oftheinputimage,f(x,y).
2.Formabinaryimage,g(x,y),whosevalueatanypairof
coordinates(x,y)isgivenby:
whereT
Misathreshold,Aisaspecificangledirection,and±T
A
definesa“band”ofacceptabledirectionaboutA.
3.Scantherowsofgandfillallgapsineachrowthatdonotexceed
aspecifiedlength,K.
4.Todetectgapsinotherdirection,θ,rotategbythisangleand
applythehorizontalscanningprocedureinstep3.Rotatethe
resultbackby–θ.1, ( , ) AND ( , )
( , )
0, Otherwise
MA
M x y T x y A T
g x y
Edge Linking and Boundary Detection
Local Processing: Example
In this example,
we can find the
license plate
candidate after
edge linking
process.
Edge Linking and Boundary Detection
Global Processing via the Hough Transform
Edge Linking and Boundary Detection
Global Processing via the Hough Transform
•Houghtransform:awayoffindingedgepointsinanimage
thatliealongastraightline.
•Example:xy-planev.s.ab-plane(parameterspace)baxy
ii
Edge Linking and Boundary Detection
Global Processing via the Hough Transform
•TheHoughtransformconsistsof
findingallpairsofvaluesof
andwhichsatisfytheequations
thatpassthrough(x,y).
•Theseareaccumulatedinwhatis
basicallya2-dimensional
histogram.
•Whenplottedthesepairsofand
willlooklikeasinewave.The
processisrepeatedforall
appropriate(x,y)locations. sincosyx
Edge Linking and Boundary Detection
Hough Transform Example
The intersection of the
curves corresponding
to points 1,3,5
2,3,4
1,4
Edge Linking and Boundary Detection
Hough Transform Example
Thresholding
•Assumption: the range of intensity levels covered by objects of
interest is different from the background.
Single thresholdMultiple threshold
Tyxf
Tyxf
yxg
),( if 0
),( if 1
),(
Thresholding
The Role of Illumination
Thresholding
The Role of Illumination
(a)(c)
(e)(d)),(),(),( yxryxiyxf ),(yxi ),(yxr
Thresholding
Basic Global Thresholding
Thresholding
Basic Global Thresholding
Thresholding
Basic Adaptive Thresholding
Thresholding
Basic Adaptive Thresholding
How to solve this problem?
Thresholding
Optimal Global and Adaptive Thresholding
•This method treats pixel values as probability density functions.
•The goal of this method is to minimize the probability of
misclassifying pixelsas either object or background.
•There are two kinds of error:
–mislabeling an object pixel as background, and
–mislabeling a background pixel as object.
Thresholding
Use of Boundary Characteristics
Thresholding
Thresholds Based on Several Variables
Color image
Region-Based Segmentation
Basic Formulation
•Let Rrepresent the entire image region.
•Segmentation is a process that partitions Rinto subregions,
R
1,R
2,…,R
n, such that
where P(R
k): a logical predicate defined over the points in set R
k
For example: P(R
k)=TRUE if all pixels in R
k have the same gray
level.RR
i
n
i
1
(a) jijiRR
ji , and allfor (c) niR
i ,...,2,1 region, connected a is (b) niRP
i ,...,2,1for TRUE)( (d) jiji RRRRP and regionsadjacent any for FALSE)( (e)
Region-Based Segmentation
Region Growing
Region-Based Segmentation
Region Growing
•Fig. 10.41 shows the histogram of Fig. 10.40 (a). It is difficult to
segment the defects by thresholding methods. (Applying region
growing methods are better in this case.)
Figure 10.41
Figure 10.40(a)
Region-Based Segmentation
Region Splitting and Merging
•Regionsplittingistheoppositeofregiongrowing.
–Firstthereisalargeregion(possibletheentireimage).
–Thenapredicate(measurement)isusedtodetermineifthe
regionisuniform.
–Ifnot,thenthemethodrequiresthattheregionbesplitinto
tworegions.
–Theneachofthesetworegionsisindependentlytestedby
thepredicate(measurement).
–Thisprocedurecontinuesuntilallresultingregionsare
uniform.
Region-Based Segmentation
Region Splitting
•Themainproblemwithregionsplittingisdeterminingwhereto
splitaregion.
•Onemethodtodividearegionistouseaquadtreestructure.
•Quadtree:atreeinwhichnodeshaveexactlyfourdescendants.
Region-Based Segmentation
Region Splitting and Merging
•Thesplitandmergeprocedure:
–SplitintofourdisjointquadrantsanyregionR
iforwhich
P(R
i)=FALSE.
–MergeanyadjacentregionsR
jandR
kforwhichP(R
jUR
k)=
TRUE.(thequadtreestructuremaynotbepreserved)
–Stopwhennofurthermergingorsplittingispossible.