0% found this document useful (0 votes)
10 views

Week 12 - L2

The document covers advanced concepts in image processing, focusing on line detection and edge detection techniques. It discusses various edge models, the mathematical expressions used in algorithms, and the importance of smoothing and thresholding in edge detection. Additionally, it highlights different edge detection masks and their applications in identifying edges within images.

Uploaded by

dr.tamer.nassef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Week 12 - L2

The document covers advanced concepts in image processing, focusing on line detection and edge detection techniques. It discusses various edge models, the mathematical expressions used in algorithms, and the importance of smoothing and thresholding in edge detection. Additionally, it highlights different edge detection masks and their applications in identifying edges within images.

Uploaded by

dr.tamer.nassef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

CS389 – Image Processing

Week 12 - Lecture 2

Image Segmentation (Pt. 2)

Dr. Mohamed Nagy Saad


Associate Professor
Faculty of Computer Science
October University for Modern Sciences and Arts
(MSA University)
Fall 2024
Line Detection

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.

 The similar idea is used with other masks.

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.

 The points that are left are the


strongest
responses, which, for lines one pixel
thick,
correspond closest to the direction
defined by
the mask.
Edge Models

Step Edge Ramp Edge Roof Edge

• Edges are closely modeled as having an intensity ramp profile.


• Edge Point: is any point contained in the ramp.
• Edge Segment: is a set of edge points that are connected.
• Models allows to write a mathematical expressions which used in image processing algorithms.
Modeling Intensity Changes
• Edges can be modeled according to their intensity profiles:
ideal reality
• Step (jump) edge:
− the image intensity
abruptly changes from
one value on one side
of the discontinuity to a
different value on the
opposite side.
• Ramp edge:
− a step edge where the
intensity change is not
instantaneous but occurs
over a finite distance.
Step edge (without and with noise)
Modeling Intensity Changes
• Ridge edge:
− the image intensity abruptly changes value but then returns to the
starting value within some short distance
− generated usually by lines

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.

 2ndOD : Can be used to determine whether


an edge pixel lies on the dark or light side of
an edge.
Dark Side  +ve & Light Side -ve

Two additional properties of 2ndOD:


(1) Produce two values for any edge in an image
(Undesirable).
(a) Two regions of constant intensity separated by an ideal
(2) Its zero crossings can be used for locating the vertical ramp edge.
centers of THICK EDGES. (b) Detail near the edge, showing a horizontal intensity
profile, together with its first and second derivatives.
Edge
Detection

FIGURE 10.11 First column: Images and intensity


profiles of a ramp edge corrupted by random
Gaussian noise of zero mean and standard
deviations of 0.0, 0.1, 1.0, and 10.0 intensity
levels, respectively. Second column: First-
derivative images and intensity profiles.Third
Edge Detection
First column:
Images and intensity profiles of a ramp edge
corrupted by random Gaussian noise of
zero mean and standard deviations of 0.0 &
0.1. intensity levels, respectively.

Second column:

1stOD images & intensity profiles. Notes:


1. The derivatives techniques are highly sensitive to noise where the
Third column: noise is almost invisible in the images.

2. 2ndOD is more sensitive to noise than 1stOD.


2ndOD images & intensity profiles.
3. Therefore, image smoothing should be a serious consideration prior
to the use of derivatives in applications where noise is present.
Edge Detection
• The three steps of edge detection:

− Smoothing: suppress as much noise as possible, without destroying


the true edges.

− Detection: determine which edge pixels should be discarded as noise and


which should be retained (usually, thresholding provides the criterion used for
detection).

− Localization: determine the exact location of an edge.


Edge thinning and linking are usually required in this step.
Edge Detection
• Edge descriptors
− Edge normal (Gradient): unit vector in the direction of maximum intensity
change.
− Edge direction: unit vector perpendicular to the edge normal.
− Edge position or center: the image position at which the edge is located.
− Edge strength: related to the local image contrast along the normal.
Remember
The gradient image & its properties:

  Strength of the edge.

  Length of gradient vector

  Direction of gradient vector


Measured with respect to the X-axis
Edge Detection
• Edge detection using derivatives

− Calculus describes changes of continuous functions using derivatives.

− An image is a 2D function, so operators describing edges are expressed using


partial derivatives.

− Points which lie on an edge can be detected by either:


− detecting local maxima or minima of the first derivative.
− detecting the zero-crossing of the second derivative.
Edge Detection

(a) shows a zoomed section of an


image containing a straight
edge segment.

(b) shows the gradient vector and


its direction angle.

(c) illustrates the important fact


mentioned earlier that the edge
 Each square in the figure represents one pixel. at a point is orthogonal to the
gradient vector at that point.
 Note that the edge direction at arbitrary point is perpendicular to the direction of the gradient
vector .

 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.

f (x)  f (x 1) Backward difference


f  (x)

f (x 1)  f (x) Forward difference
f  (x)

f (x 1)  f (x 1) Central difference
f  (x)

Edge Detection
• Computing the 1st derivative – cont.
− Examples using the edge models and the mask [ -1 0 1] (centered
about x):
。 Prewitt filters
Consider f ( x  1)  f ( x  1)
Horizontal filter: [-1 0 1] , Smooth filter: [1 1 1]
 1   1 0 1
Combine Px  1   1 0 1   1 0 1
 1   1 0 1

 -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

Edge image Binary image Thinning


。 Roberts operator: Roberts operator
 1 0 0  0 1 0
Px  0 -1 0  , Py  -1 0 0 
   
 0 0 0   0 0 0 
。 Sobel operator:
 -1 0 1   -1 -2 -1
Px  -2 0 2  , Py  0 0 0 
   
 -1 0 1   1 2 1 
。 Robinson operator: Sobel operator
1 1 1   1 1 1
Px  1  2 1  , Py   1  2 1
   
  1  1  1   1 1 1
。 Kirsch operator:
 3 3 3   5 3 3
Px  3 0 3  , Py   5 0 3
   
  5  5  5   5 3 3
Edge Detection
Edge Detection Masks (1stOD) Diagonal Edges
1- Sobel Operators

°
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

Original Image Horizontal Vertical Gradient Magnitude Image

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

Original Image Horizontal Vertical Gradient Magnitude Image


Smoothed with
Edge Detection
2) Thresholding the gradient Magnitude image

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:

Thresholded version of the Magnitude image resulted from the first


method obtained using a threshold equal to 33% of the highest value in that
image.

You might also like