Title: Chapter 2: Image Analysis
1Chapter 2 Image Analysis
2Edge/Line Detection
- There are various types of operators that can be
used to perform edge/line detection. - Many edge/line detection operators are
implemented with convolution mask. - The concept behind edge detection is to measure
the rate of change in brightness.
3Edge/Line Detection
- A large change of brightness over a short spatial
distance indicates the presence of an edge. - Edge detection operators return information
regarding the edge magnitude. - A larger change in brightness would return a
higher edge magnitude. - Some edge detection operators even return
information regarding the direction of the edge.
4Edge/Line Detection
- The output of an edge detection process can be
visualized in two ways - Using a binary image where the edges are
highlighted in white (1) and everything else in
black (0). - Using a gray level image where the edges are
highlighted using white color of varying
brightness. Edges with higher magnitude will
produce brighter white.
5Edge/Line Detection
6Edge/Line Detection
- Before edge detection is performed, some
pre-processing may need to be done. - For example, the existence of noise can create
problems in performing edge detection. - It is best to preprocess an image to
eliminate/minimize noise effects using mean or
median filters.
7Edge/Line Detection
8Edge/Line Detection
9Edge/Line Detection
- When dealing with noise, there is a tradeoff
between the sensitivity and the accuracy of an
edge detector. - Sensitivity refers to how easy it is for the edge
detector to detect edges. - A sensitive edge detector can detect edges more
easily. - Making an edge detector too sensitive or less
sensitive has its own pros and cons. - If an edge detector is too sensitive, it may
return many edge points which are noise. - If it is less sensitive, it may miss valid edges.
10Edge/Line Detection
- The sensitivity of an edge detection operator
depends on - Size of the edge detection mask.
- The value of the gray-level threshold.
- Mask size
- A larger mask size makes the edge detector less
sensitive. - Value of gray-level threshold
- A higher threshold makes the edge detector less
sensitive.
11Roberts Operator
- Mark edge points only does not return any
information about edge orientation. - The simplest operator and work best with binary
images. - There are two forms of Roberts operator.
- Square root of the sum of the difference of the
diagonal neighbors squared.
12Robert Operators
- The sum of the magnitude of the differences of
the diagonal neighbors.
- The second form is often used in practice due to
its computational efficiency. - It is typically faster for a computer to find an
absolute value than to find square roots.
13Sobel Operator
- Look for edges in both the horizontal and
vertical directions and then combine this
information into a single metric.
14Sobel Operator
- Each of the masks are convolved with the image.
- At each pixel location, there will now be two
numbers - s1 corresponding to the result from row mask.
- s2 corresponding to the result from column mask.
- These two numbers are then used to compute the
edge magnitude and direction.
15Sobel Operator
- The edge direction is defined as the degree from
the vertical axis in clockwise direction.
16Prewitt Operator
- Similar to the Sobel operator, except that it has
different mask coefficients.
17Prewitt Operator
- Each of the masks is convolved with the image.
- At each pixel location, there will now be two
numbers - p1 corresponding to the result from row mask.
- p2 corresponding to the result from column mask.
- These two numbers are then used to compute the
edge magnitude and direction.
18Prewitt Operator
- The edge direction is defined as the degree from
the vertical axis in clockwise direction.
19Kirsch Compass Masks
- The masks are defined by taking a single mask,
and rotating it to eight major compass direction - North, Northwest, West, Southwest, South,
Southeast, East, and Northeast. - The masks are defined as follows
20Kirsch Compass Masks
21Kirsch Compass Masks
- The edge magnitude is defined as the maximum
value found by the convolution of each of the
masks with the image. - The edge direction is defined by the mask that
produces the maximum magnitude. For example - Mask K0 corresponds to a vertical edge.
- Mask K5 corresponds to a diagonal edge in the
northwest/southeast direction.
22Robinson Compass Mask
- Used in a similar manner to the Kirsch masks, but
are easier to implement. - Only has coefficients of 0, 1 and 2.
- Symmetrical about their directional axis the
axis with zeros. - Only need to compute the result on four of the
masks. The results of the other four can be
obtained by negating the first four results.
23Robinson Compass Masks
24Robinson Compass Masks
- The edge magnitude and direction are defined in
the same way as in Kirsch masks. - Notice that r0 and r6 are the same as the Sobel
masks. - Actually, any of the edge detection masks can be
extended by rotating them in a manner similar to
these compass masks. - Example One may rotate Prewitt operator.
25Laplacian Operators
- The laplacian masks are rotationally symmetric
edges at all direction contribute to the result. - They are applied by selecting one mask and
convolving it with the image. - The sign of the result (positive or negative)
from two adjacent pixel locations tells which
side of the edge is brighter.
26Laplacian Operators
- Notice that the laplacian masks here are
different from the enhancement filters used in
preprocessing. - Center coefficient is decreased by one.
- Sum of the mask coefficients becomes zero.
- Does not retain original brightness, only return
edge information.
27Frei-Chen Masks
- They form a complete set of basis vectors.
- We can represent any 3x3 subimage as a weighted
sum of the nine Frei-Chen masks. - These weights are found by projecting a 3x3
subimage onto each of these masks. - The projection process is similar to convolution
process. - Overlay the mask on the image, multiply
coincident terms and sum the results.
28Frei-Chen Masks
29Frei-Chen Masks
30Frei-Chen Masks
31Frei-Chen Masks
- One can reconstruct the image with the weight and
also the masks. - Take the weight, multiply with the masks and sum
the corresponding values.
32Frei-Chen Masks
- To use Frei-Chen masks for edge detection
- Select a particular subspace of interest
(horizontal edge, vertical edge, etc) and find
the relative projection of the image onto the
particular subspace. - The advantage of this method is that we can
select particular edge or line masks of interest
and consider the projection of those masks only.
33Frei-Chen Masks
- The set e consist of the marks of interest.
- The (Is, fk) notation refers to the process of
overlaying the mask on the subimage, multiplying
the coincident terms and summing the results (a
vector inner product).
34Frei-Chen Masks
- The output of Frei-Chen Masks operation is a
theta (?) value. - This value ranges from 0 to 90 degree.
- This value acts like an edge magnitude.
- Smaller theta (?) corresponds to higher magnitude.
35Edge Operator Performance
- To evaluate the performance of different edge
detection operators, we need to use both
objective and subjective evaluation. - Objective evaluation measure using fixed
analytical methods. - Subjective evaluation let human view the image.
36Edge Operator Performance
- In order to develop a performance metric for edge
detector, we need to define - What constitutes success.
- What types of errors can occur.
- The types of errors are
- Missing valid edge points.
- Classifying noise pulses as valid edge points.
- Smeared edges.
37Edge Operator Performance
38Edge Operator Performance
39Edge Operator Performance
One metric called Pratt Figure of Merit Rating
Factor is define as follow
IN the maximum of II and IF II the number of
ideal edge points in the image IF the number of
edge points found by the edge detector ? a
scaling constant that can be adjusted to adjust
the penalty for offset edges d the distance of
a found edge point to an ideal edge point
40Edge Operator Performance
- For this metric, R will be 1 for a perfect edge.
- In general, this metric assigns a better rating
to smeared edges than to offset or missing edges. - This is done because there exist techniques to
thin smeared edges, but it is difficult to
determine when an edge is missed.
41Edge Operator Performance
- The objective metrics are often of limited use in
practical applications. - The subjective evaluation by human visual system
is still superior than any computer vision system.
42Edge Operator Performance
43Edge Operator Performance
44Edge Operator Performance
45Edge Operator Performance
46Edge Operator Performance
- All operators return almost similar results
except the laplacian operators. - Laplacian returns positive and negative numbers
that get linearly remapped to 0 to 255. - The background value of 0 is mapped to some
intermediate gray level. - Only the magnitude is used for displaying the
results.
47Edge Operator Performance
- If we add noise to the image, the results are not
as good. - There are a number of ways to solve this
- Preprocess the image with spatial filters to
remove the noise. - Expand the edge detection operators.
48Edge Operator Performance
Extended Prewitt Edge Detection Mask
Extended Sobel Edge Detection Mask
49Edge Operator Performance
- We can also define a truncated pyramid operator.
- This operator provides weights that decrease as
we get away from the center pixel.
50Edge Operator Performance
51Edge Operator Performance
52Edge Operator Performance
53Edge Operator Performance
54Edge Operator Performance
- On images with noise, the extended operators
exhibit better performance than the 3x3 masks. - However, they have a number of setbacks
- Requires more computation.
- Tends to slightly blur the edges.
55Hough Transform
- Hough transform is used to find lines.
- A line is defined as a collection of edge points
that are adjacent and have the same direction. - Hough transform will take a collection of edge
points found by an edge detector, and find all
the lines on which these edge points lie.
56Hough Transform
- In order to understand Hough transform, consider
the normal (perpendicular) representation of a
line - ? r cos ? c sin ?
- Each pair of ? and ? corresponds to a possible
line equation. - The range of ? is ? 90o
- The range of ? is from 0 to ?2N (N is image size)
57Hough Transform
58Hough Transform
- A line is a path where points that lie on it have
the same direction (share the same line
equation). - The idea is to find the number of points that lie
in each possible line within an image plane. - The line that accommodates the most points shall
be the candidate line.
59Hough Transform
- However, in practical, there tend to be many
lines. - Therefore, in practice, a line is selected if the
number of points that lie on it is more than
certain threshold (user-defined). - We cannot have infinite precision for ? and ? or
we will have infinite line equations. - Therefore, we need to quantize the ?? parameter
space.
60Hough Transform
61Hough Transform
- Each block in the quantized space corresponds to
a line, or group of possible lines. - The algorithm used for Hough Transform consists
of three primary steps - Define the desired increments on ? and ?, ?? and
??, and quantize the space accordingly.
62Hough Transform
- For every point of interest (edge points), plug
the values for r and c into the line equation - ? r cos ? c sin ?
- Then, for each value of ? in the quantized
space, solve for ?. - For each ?? pair from step 2, record the rc pair
in the corresponding block in the quantized
space. This constitutes a hit for that particular
block.
63Hough Transform
- When this process is completed, the number of
hits in each block corresponds to the number of
pixels on the line as defined by the values ? and
? in that block. - Next, select a threshold and select the
quantization blocks that contain more points than
the threshold.
64Hough Transform
- When this process is completed, the lines are
marked in the output image. - There is a tradeoff in choosing the size of the
quantization blocks - Large blocks will reduce search time.
- However, it may reduce the line resolution in the
image space.
65Hough Transform
66Hough Transform
67Hough Transform
68Hough Transform