SlideShare a Scribd company logo
1 of 26
Download to read offline
2.3 Feature extraction
Many computer vision systems rely on first the
detection of some features in the images.

                    How many peppers in this image?
                    Detect boundaries of peppers

                    How many red peppers, and how
                    many green peppers in this
                    image?
                    Detect colors of peppers
2.3.1 Edge detection
Edges are pixels at or around which the image
values undergo a sharp variation.
However, noise can also cause intensity variations.




A good edge detector should suppress image noise,
enhance and locate true edge pixels.
Types of edge




           step edge       ramp edge




           line edge          roof edge

Real edge may have multiple types superimposed with
noise, e.g. ramp + line + noise.
Edge descriptor – result of edge detection
        edge direction            edge normal




edge position - coordinates
edge direction - vector
edge normal - vector
edge strength – numeric value
Edge detection methods usually rely on calculations
of the first or second derivative along the intensity
profile.
            I                      edge pixel

                                   local peak
            I’




            I”



                                   zero crossing
First derivative operator
                                                ∂I 
                                        G x   ∂x 
Calculate image gradient G (I( x, y)) =   =  ∂I 
                                        G y   
                                                ∂y 
                                                
  magnitude G (I( x, y)) = G 2 + G 2
                             x     y


  approximation
   G ( I( x , y)) = G x + G y or G ( I( x , y)) = max( G x , G y )


  direction (with respect to x axis)
                        Gy   
   ∠G (I( x, y)) = tan 
                      −1
                       G     
                              
                        x    
  Threshold the gradient magnitudes to locate edges.
Discrete approximation
G x ≅ I[i, j + 1] − I[i, j]   Gx =   -1   1       Gy =   1    1

G y ≅ I[i, j] − I[i + 1, j]          -1   1              -1   -1

                                          convolution masks

The gradient is measured
                1       1
at coordinates i + , j + 
                2       2
To avoid having the gradient calculated about an
  interpolated point between pixels, you can use a 3 x 3
  neighborhood, e.g. Sobel edge detector.

    magnitude S(I( x, y)) = S 2 + S 2
                              x     y


                  Sx =   -1   0    1      Sy =   1    2    1

                         -2   0    2             0    0    0

                         -1   0    1             -1   -2   -1


                                  convolution masks
The gradient is
measured at coordinates [i, j]
function sobeled(t)
% to perform Sobel edge detection
% threshold is t

[f_name, f_path] = uigetfile('*.bmp', 'Select an input image');
in_name = [f_path, f_name];
image = imread(in_name);
[height, width] = size(image);
imshow(image)

h = fspecial('sobel');
sx = imfilter(image, h);                      calculate Sx
v = h';
sy = imfilter(image, v);                       calculate Sy
for i = 1:height
   for j = 1:width
      mag(i,j)=sqrt(double(sx(i,j))^2+double(sy(i,j))^2);         calculate magnitude
      if mag(i,j) > t
         sedimage(i,j) = 255;
      else                       thresholding
         sedimage(i,j) = 0;
      end
   end
end

figure
imshow(sedimage)

% save edge detection result
out_name = [f_path, 'sed_', f_name];
imwrite(sedimage, out_name, 'BMP');

end
Original             Threshold = 100

Do you see any defects in the Sobel edge
detection result?
The errors in edge detection are false edges (false
positive FP) and missing edges (false negative FN).



Can you design other Sobel convolution masks for
measuring gradient in other directions?
Second derivative operator
The zero crossings can be
                                       ∂ 2I ∂ 2I
located by the Laplacian ∇ 2 I( x, y) = 2 + 2
                                       ∂x   ∂y
operator

Discrete approximation
   2
                                               ∇2 ≈   0   1    0
 ∂ I
    2
      = I[i, j + 1] − 2I[i, j] + I[i, j − 1]
 ∂x                                                   1   -4   1
 ∂ 2I
    2
      = I[i + 1, j] − 2I[i, j] + I[i − 1, j]          0   1    0
 ∂y

                                               convolution mask
The actual edge location must be determined by
interpolation.
    2 2 2 2 2 8 8 8 8 8
    2 2 2 2 2 8 8 8 8 8                 Image with a
    2 2 2 2 2 8 8 8 8 8
                                        vertical step
    2 2 2 2 2 8 8 8 8 8
                                        edge
    2 2 2 2 2 8 8 8 8 8
    2 2 2 2 2 8 8 8 8 8

       0   0   0   6   -6   0   0   0
       0   0   0   6   -6   0   0   0   Result of the
       0   0   0   6   -6   0   0   0   Laplacian
       0   0   0   6   -6   0   0   0   operation
Edge operator involving two derivatives is affected by
noise more than an operator involving a single
derivative.
A better approach is to combine Gaussian filtering with
the second derivative – Laplacian of Gaussian (LoG).
• filter out the image noise using Gaussian filter
• enhance the edge pixels using 2D Laplacian
  operator
• edge is detected when there is a zero crossing in
  the second derivative with a corresponding large
  peak in the first derivative
• estimate the edge location with sub-pixel
  resolution using linear interpolation
Original            5 x 5 LoG mask, σ = 0.5

LoG edge detector can be implemented using the
MATLAB function edge.
An edge detector can reduce noise by smoothing the
image, but this will result in spreading of edges and
add uncertainty to the location of edge.
                            original image

          I
                            Gaussian smoothed image

  threshold
          I’                edge detection result

          I
          ”
               thick edge


An edge detector can have greater sensitivity to the
presence of edges, but this will also increase the
sensitivity of the detector to noise.
The best compromise between noise immunity and
edge localization is the first derivative of a Gaussian –
e.g. Canny edge detector.
• edge enhancement
• non-maximum suppression
• hysteresis thresholding
edge enhancement:
 Apply Gaussian smoothing to the image.
      S[i, j] = G[i, j; σ] ∗ I[i, j]
 G is a Gaussian with zero mean and standard deviation σ
 Compute the gradient of the smoothed image and
 estimate the magnitude and orientation of the gradient.
          (S[i, j + 1] − S[i, j] + S[i + 1, j + 1] − S[i + 1, j])
P[i, j] =
                                    2                             M[i, j] =   P[i, j] 2 + Q[i, j] 2
          (S[i, j] − S[i + 1, j] + S[i, j + 1] − S[i + 1, j + 1])
Q[i, j] =
                                     2                                         Q[i, j] 
                                                                θ[i, j] = tan 
                                                                               P[i, j] 
                                                                                 −1
                                                                                        
                                                                                       
non-maximum suppression:
M[i, j] may contain wide ridges around the local
maximum. This step is to thin such ridges to produce 1-
pixel wide edges. Values of M[i, j] along the edge
normal that are not peak will be suppressed.

Quantize edge normal orientations into 4, e.g. 0°, 45°,
90°, and 135° with respect to the horizontal axis. For
each pixel (i, j), find the orientation which best
approximates θ[i, j].

If M[i, j] is smaller than at least one of its two neighbors
along the quantized orientation, set M’[i, j] to zero.
Otherwise M’[i, j] = M[i, j].
hysteresis thresholding:
M’[i, j], after the non-maximum suppression step, may
still contain local maxima created by noise. To get rid of
false edges by thresholding, some false edges may still
remain if the threshold value is set too low, or some true
edges may be deleted if the threshold value is set too
high.

An effective scheme is to use 2 thresholds τl and τh,
e.g. τh = 2τl.
Scan the non-zero points of M’[i, j] in a fixed order.

If M’[i, j] is larger than τh, locate it as an edge pixel.

Else if any 8-neighbors of (i, j) have gradient
magnitude larger than τl, locate them as edge pixels.
Continue until another edge pixel is located by τh.
Original          Thresholds [0.06 0.15], σ = 0.5

Canny edge detector can be implemented using the
MATLAB function edge.
2.3.2 Corner detection

Corners are quite stable across sequences of images.
They are interesting features that can be employed for
tracking objects across sequences of images.
Consider an image point p, a neighborhood Q of p, and
a matrix C defined as
    ∑G2x       ∑G G     x       y
                                     
 C= Q
   ∑ G G
                 Q                   
                                     
   Q x y        ∑G          2
                             y
                                     
                    Q               

We can think of C as a diagonal matrix

       λ 1      0
     C=            
       0        λ2 
The two eigenvalues λ1 and λ2 are non-negative. A
corner is located in Q where λ1 ≥ λ2 > 0 and λ2 is
large enough.

• compute the image gradient
• for each image point p, form matrix C over a
  neighborhood Q of p, compute the smaller
  eigenvalue λ2 of C, if λ2 > threshold τ save the
  coordinates of p into a list L
• sort L in decreasing order of λ2
• scan L from top to bottom, for each corner point p,
  delete neighboring corner points in L
Summary
♦ feature extraction – edge detection, corner
  detection

♦ first derivative edge detector

♦ second derivative edge detector

♦ Canny edge detector

More Related Content

What's hot

Adaptive Signal and Image Processing
Adaptive Signal and Image ProcessingAdaptive Signal and Image Processing
Adaptive Signal and Image ProcessingGabriel Peyré
 
Math behind the kernels
Math behind the kernelsMath behind the kernels
Math behind the kernelsRevanth Kumar
 
Kccsi 2012 a real-time robust object tracking-v2
Kccsi 2012   a real-time robust object tracking-v2Kccsi 2012   a real-time robust object tracking-v2
Kccsi 2012 a real-time robust object tracking-v2Prarinya Siritanawan
 
Lesson18 Double Integrals Over Rectangles Slides
Lesson18   Double Integrals Over Rectangles SlidesLesson18   Double Integrals Over Rectangles Slides
Lesson18 Double Integrals Over Rectangles SlidesMatthew Leingang
 
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수Youngman Choe
 
Physics of Algorithms Talk
Physics of Algorithms TalkPhysics of Algorithms Talk
Physics of Algorithms Talkjasonj383
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processingMohammed Kamel
 
5 spatial filtering p1
5 spatial filtering p15 spatial filtering p1
5 spatial filtering p1Gichelle Amon
 
Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3SIMONTHOMAS S
 
Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Leonid Zhukov
 
NIPS2008: tutorial: statistical models of visual images
NIPS2008: tutorial: statistical models of visual imagesNIPS2008: tutorial: statistical models of visual images
NIPS2008: tutorial: statistical models of visual imageszukun
 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median FiltersAmnaakhaan
 
Generalization of Compositons of Cellular Automata on Groups
Generalization of Compositons of Cellular Automata on GroupsGeneralization of Compositons of Cellular Automata on Groups
Generalization of Compositons of Cellular Automata on GroupsYoshihiro Mizoguchi
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-softwarezukun
 

What's hot (20)

Adaptive Signal and Image Processing
Adaptive Signal and Image ProcessingAdaptive Signal and Image Processing
Adaptive Signal and Image Processing
 
Math behind the kernels
Math behind the kernelsMath behind the kernels
Math behind the kernels
 
Kccsi 2012 a real-time robust object tracking-v2
Kccsi 2012   a real-time robust object tracking-v2Kccsi 2012   a real-time robust object tracking-v2
Kccsi 2012 a real-time robust object tracking-v2
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
Mathematical tools in dip
 
Lesson18 Double Integrals Over Rectangles Slides
Lesson18   Double Integrals Over Rectangles SlidesLesson18   Double Integrals Over Rectangles Slides
Lesson18 Double Integrals Over Rectangles Slides
 
iTute Notes MM
iTute Notes MMiTute Notes MM
iTute Notes MM
 
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수
110218 [아꿈사발표자료] taocp#1 1.2.9. 생성함수
 
Physics of Algorithms Talk
Physics of Algorithms TalkPhysics of Algorithms Talk
Physics of Algorithms Talk
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processing
 
5 spatial filtering p1
5 spatial filtering p15 spatial filtering p1
5 spatial filtering p1
 
Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3
 
Mo u quantified
Mo u   quantifiedMo u   quantified
Mo u quantified
 
Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.Numerical Linear Algebra for Data and Link Analysis.
Numerical Linear Algebra for Data and Link Analysis.
 
NIPS2008: tutorial: statistical models of visual images
NIPS2008: tutorial: statistical models of visual imagesNIPS2008: tutorial: statistical models of visual images
NIPS2008: tutorial: statistical models of visual images
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median Filters
 
Generalization of Compositons of Cellular Automata on Groups
Generalization of Compositons of Cellular Automata on GroupsGeneralization of Compositons of Cellular Automata on Groups
Generalization of Compositons of Cellular Automata on Groups
 
Dip Morphological
Dip MorphologicalDip Morphological
Dip Morphological
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-software
 

Similar to Test

Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Editor IJARCET
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Editor IJARCET
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).pptNoorUlHaq47
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.pptAVUDAI1
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.pptDEEPUKUMARR
 
Introduction to Digital image processing
Introduction to Digital image processing Introduction to Digital image processing
Introduction to Digital image processing Sairam Geethanath
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and codeVaddi Manikanta
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1ankuredkie
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingFayan TAO
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1?? ?
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentationasodariyabhavesh
 
image segmentation by ppres.pptx
image segmentation by ppres.pptximage segmentation by ppres.pptx
image segmentation by ppres.pptxmohan134666
 
Image segmentation
Image segmentation Image segmentation
Image segmentation Amnaakhaan
 

Similar to Test (20)

Edge detection
Edge detectionEdge detection
Edge detection
 
Test
TestTest
Test
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).ppt
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.ppt
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.ppt
 
Introduction to Digital image processing
Introduction to Digital image processing Introduction to Digital image processing
Introduction to Digital image processing
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and code
 
735
735735
735
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume rendering
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1
 
Primitives
PrimitivesPrimitives
Primitives
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
image segmentation by ppres.pptx
image segmentation by ppres.pptximage segmentation by ppres.pptx
image segmentation by ppres.pptx
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 

More from Kinni MEW (16)

Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Lec1
Lec1Lec1
Lec1
 

Test

  • 1. 2.3 Feature extraction Many computer vision systems rely on first the detection of some features in the images. How many peppers in this image? Detect boundaries of peppers How many red peppers, and how many green peppers in this image? Detect colors of peppers
  • 2. 2.3.1 Edge detection Edges are pixels at or around which the image values undergo a sharp variation. However, noise can also cause intensity variations. A good edge detector should suppress image noise, enhance and locate true edge pixels.
  • 3. Types of edge step edge ramp edge line edge roof edge Real edge may have multiple types superimposed with noise, e.g. ramp + line + noise.
  • 4. Edge descriptor – result of edge detection edge direction edge normal edge position - coordinates edge direction - vector edge normal - vector edge strength – numeric value
  • 5. Edge detection methods usually rely on calculations of the first or second derivative along the intensity profile. I edge pixel local peak I’ I” zero crossing
  • 6. First derivative operator  ∂I  G x   ∂x  Calculate image gradient G (I( x, y)) =   =  ∂I  G y     ∂y    magnitude G (I( x, y)) = G 2 + G 2 x y approximation G ( I( x , y)) = G x + G y or G ( I( x , y)) = max( G x , G y ) direction (with respect to x axis)  Gy  ∠G (I( x, y)) = tan  −1 G    x  Threshold the gradient magnitudes to locate edges.
  • 7. Discrete approximation G x ≅ I[i, j + 1] − I[i, j] Gx = -1 1 Gy = 1 1 G y ≅ I[i, j] − I[i + 1, j] -1 1 -1 -1 convolution masks The gradient is measured  1 1 at coordinates i + , j +   2 2
  • 8. To avoid having the gradient calculated about an interpolated point between pixels, you can use a 3 x 3 neighborhood, e.g. Sobel edge detector. magnitude S(I( x, y)) = S 2 + S 2 x y Sx = -1 0 1 Sy = 1 2 1 -2 0 2 0 0 0 -1 0 1 -1 -2 -1 convolution masks The gradient is measured at coordinates [i, j]
  • 9. function sobeled(t) % to perform Sobel edge detection % threshold is t [f_name, f_path] = uigetfile('*.bmp', 'Select an input image'); in_name = [f_path, f_name]; image = imread(in_name); [height, width] = size(image); imshow(image) h = fspecial('sobel'); sx = imfilter(image, h); calculate Sx v = h'; sy = imfilter(image, v); calculate Sy for i = 1:height for j = 1:width mag(i,j)=sqrt(double(sx(i,j))^2+double(sy(i,j))^2); calculate magnitude if mag(i,j) > t sedimage(i,j) = 255; else thresholding sedimage(i,j) = 0; end end end figure imshow(sedimage) % save edge detection result out_name = [f_path, 'sed_', f_name]; imwrite(sedimage, out_name, 'BMP'); end
  • 10. Original Threshold = 100 Do you see any defects in the Sobel edge detection result?
  • 11. The errors in edge detection are false edges (false positive FP) and missing edges (false negative FN). Can you design other Sobel convolution masks for measuring gradient in other directions?
  • 12. Second derivative operator The zero crossings can be ∂ 2I ∂ 2I located by the Laplacian ∇ 2 I( x, y) = 2 + 2 ∂x ∂y operator Discrete approximation 2 ∇2 ≈ 0 1 0 ∂ I 2 = I[i, j + 1] − 2I[i, j] + I[i, j − 1] ∂x 1 -4 1 ∂ 2I 2 = I[i + 1, j] − 2I[i, j] + I[i − 1, j] 0 1 0 ∂y convolution mask
  • 13. The actual edge location must be determined by interpolation. 2 2 2 2 2 8 8 8 8 8 2 2 2 2 2 8 8 8 8 8 Image with a 2 2 2 2 2 8 8 8 8 8 vertical step 2 2 2 2 2 8 8 8 8 8 edge 2 2 2 2 2 8 8 8 8 8 2 2 2 2 2 8 8 8 8 8 0 0 0 6 -6 0 0 0 0 0 0 6 -6 0 0 0 Result of the 0 0 0 6 -6 0 0 0 Laplacian 0 0 0 6 -6 0 0 0 operation
  • 14. Edge operator involving two derivatives is affected by noise more than an operator involving a single derivative. A better approach is to combine Gaussian filtering with the second derivative – Laplacian of Gaussian (LoG). • filter out the image noise using Gaussian filter • enhance the edge pixels using 2D Laplacian operator • edge is detected when there is a zero crossing in the second derivative with a corresponding large peak in the first derivative • estimate the edge location with sub-pixel resolution using linear interpolation
  • 15. Original 5 x 5 LoG mask, σ = 0.5 LoG edge detector can be implemented using the MATLAB function edge.
  • 16. An edge detector can reduce noise by smoothing the image, but this will result in spreading of edges and add uncertainty to the location of edge. original image I Gaussian smoothed image threshold I’ edge detection result I ” thick edge An edge detector can have greater sensitivity to the presence of edges, but this will also increase the sensitivity of the detector to noise.
  • 17. The best compromise between noise immunity and edge localization is the first derivative of a Gaussian – e.g. Canny edge detector. • edge enhancement • non-maximum suppression • hysteresis thresholding
  • 18. edge enhancement: Apply Gaussian smoothing to the image. S[i, j] = G[i, j; σ] ∗ I[i, j] G is a Gaussian with zero mean and standard deviation σ Compute the gradient of the smoothed image and estimate the magnitude and orientation of the gradient. (S[i, j + 1] − S[i, j] + S[i + 1, j + 1] − S[i + 1, j]) P[i, j] = 2 M[i, j] = P[i, j] 2 + Q[i, j] 2 (S[i, j] − S[i + 1, j] + S[i, j + 1] − S[i + 1, j + 1]) Q[i, j] = 2  Q[i, j]  θ[i, j] = tan   P[i, j]  −1   
  • 19. non-maximum suppression: M[i, j] may contain wide ridges around the local maximum. This step is to thin such ridges to produce 1- pixel wide edges. Values of M[i, j] along the edge normal that are not peak will be suppressed. Quantize edge normal orientations into 4, e.g. 0°, 45°, 90°, and 135° with respect to the horizontal axis. For each pixel (i, j), find the orientation which best approximates θ[i, j]. If M[i, j] is smaller than at least one of its two neighbors along the quantized orientation, set M’[i, j] to zero. Otherwise M’[i, j] = M[i, j].
  • 20. hysteresis thresholding: M’[i, j], after the non-maximum suppression step, may still contain local maxima created by noise. To get rid of false edges by thresholding, some false edges may still remain if the threshold value is set too low, or some true edges may be deleted if the threshold value is set too high. An effective scheme is to use 2 thresholds τl and τh, e.g. τh = 2τl.
  • 21. Scan the non-zero points of M’[i, j] in a fixed order. If M’[i, j] is larger than τh, locate it as an edge pixel. Else if any 8-neighbors of (i, j) have gradient magnitude larger than τl, locate them as edge pixels. Continue until another edge pixel is located by τh.
  • 22. Original Thresholds [0.06 0.15], σ = 0.5 Canny edge detector can be implemented using the MATLAB function edge.
  • 23. 2.3.2 Corner detection Corners are quite stable across sequences of images. They are interesting features that can be employed for tracking objects across sequences of images.
  • 24. Consider an image point p, a neighborhood Q of p, and a matrix C defined as  ∑G2x ∑G G x y  C= Q ∑ G G Q   Q x y ∑G 2 y   Q  We can think of C as a diagonal matrix λ 1 0 C=  0 λ2 
  • 25. The two eigenvalues λ1 and λ2 are non-negative. A corner is located in Q where λ1 ≥ λ2 > 0 and λ2 is large enough. • compute the image gradient • for each image point p, form matrix C over a neighborhood Q of p, compute the smaller eigenvalue λ2 of C, if λ2 > threshold τ save the coordinates of p into a list L • sort L in decreasing order of λ2 • scan L from top to bottom, for each corner point p, delete neighboring corner points in L
  • 26. Summary ♦ feature extraction – edge detection, corner detection ♦ first derivative edge detector ♦ second derivative edge detector ♦ Canny edge detector