Week 12 - L2
Week 12 - L2
Week 12 - Lecture 2
Line detection masks. Angles are with respect to the axis system.
Horizontal mask will result with max response when a line passed through the
middle row of the mask with a constant background.
Note: the preferred direction of each mask is weighted with a larger coefficient (i.e.,2)
than other possible directions.
Line Detection
Apply every mask on the image .
let , , , denotes the response of the horizontal, +45
degree, vertical and -45 degree masks, respectively.
if, at a certain point in the image
|| > ||, for all j≠i,
that point is said to be more likely associated with a line in
the direction of mask i.
Line Detection
Alternatively, if we are interested in
detecting all lines in an image in the
direction defined by a given mask, we
simply run the mask through the image
and threshold the absolute value of the
result.
Line thickness
Modeling Intensity Changes
• Roof edge:
− a ridge edge where the intensity change is not instantaneous but
occurs over a finite distance
− generated usually by the intersection of surfaces
Edge Detection
1stOD: Can be used to detect the presence
of an edge at a point in an image.
Second column:
Gradient vector sometimes is called Edge Normal. When the vector is normalized to unit length
by dividing it to its magnitude so the resulted is called Edge Unit Normal.
Edge Detection
Example:
If then,
Which is the same as measured from +ve direction with respect to x-axis.
So, the direction of the edge in this example is .
All edge points in the previous figure have the same gradient .
So, the entire edge segment is in the same direction
“ A set of connected edge pixels” An edge segment
○ Derivatives Ramp edge Step edge
1 D case : Image
df f
lim
dx x 0 x
f ( x x) f ( x)
lim
x 0 x Intensity
In a discrete case, x 1 profile
df
f ( x 1) f ( x)
dx
or f ( x) f ( x 1) 1st derivative
representation
1
or ( f ( x 1) f ( x 1))
2
Edge Detection
• Computing the 1st derivative – cont.
-1
Vertical filter: 0 , Smooth filter: [1 1 1]
1
1 1 1 1
Combine Py 0 1 1 1 0 0 0
1 1 1 1
Input Vertical Horizontal
°
edges + 45 − 45°
2- Prewitt Operators
Edge Detection
Note :
Filters (masks) used to compute the derivatives needed for gradient are often called :
Gradient Operators
or Difference Operators
or Edge Detectors
Edge Detection
Notes:
-----------
1. Sobel masks have better noise-suppression ( smoothing ) characteristics.
(preferable).
2. Edge detection using the discussed masks enhance the fine details such as the
edges and also the noise.
3. Edge detection can be more selective by smoothing the original image prior to
Gradient angle image
computing the gradients ( to prevent noise enhancement ).
Edge Detection
There are two basic method for using 1stOD gradients in edge detection:
1) Smoothing prior to compute 2) Thresholding the gradient
the gradients Magnitude image
Using average filter ( e.g. average filter ) With T
Or combining them together to get a better result.
Note:
The above methods are based simply on filtering an image with one or two masks with No provisions
being made for:
(1) Edge Characteristics.
(2) Noise Content.
Edge Detection
1) Smoothing prior to compute the gradients
Notes:
Gradient Magnitude Image
This threshold was just high enough to eliminate most of
Threshold with T=33%
the brick edges (looks as a noise) in the gradient image.
Edge Detection
Combining the Two Methods yields to: