Download
image transforms n.
Skip this Video
Loading SlideShow in 5 Seconds..
Image Transforms PowerPoint Presentation
Download Presentation
Image Transforms

Image Transforms

274 Views Download Presentation
Download Presentation

Image Transforms

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Image Transforms 主講人:虞台文

  2. Content • Overview • Convolution • Edge Detection • Gradients • Sobel operator • Canny edge detector • Laplacian • Hough Transforms • Geometric Transforms • Affine Transform • Perspective Transform • Histogram Equalization

  3. Image Transforms Overview

  4. Image Transform Concept T[]

  5. Image Transform Concept T[]

  6. Image Transforms Convolution

  7. g(x,y)is known as convolution kernel. Image Convolution

  8. g(x,y)is known as convolution kernel. Image Convolution height2h + 1 width2w + 1

  9. g(x,y)is known as convolution kernel. Image Convolution height2h + 1 width2w + 1

  10. Some Convolution Kernels

  11. OpenCV Implementation  Image Filter void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1) );

  12. Deal with Convolution Boundaries void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) );

  13. Image Transforms Edge Detection

  14. Edge Detection • Convert a 2D image into a set of curves • Extracts salient features of the scene • More compact than pixels

  15. Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors

  16. How can you tell that a pixel is on an edge? Edge Detection

  17. Step Edges Line Edges Roof Edge Edge Types

  18. I x Real Edges • We want an Edge Operator that produces: • Edge Magnitude • Edge Orientation • High Detection Rate and Good Localization Noisy and Discrete!

  19. Derivatives of Image in 1D • Edges can be characterized as either: • local extrema of I(x) • zero-crossings of 2I(x)  1D image  gradient  Laplacian

  20. 2D-Image Gradient

  21. 2D-Image Gradient • Gives the direction of most rapid change in intensity • Gradient direction: • Edge strength:

  22. To precisely locate the edge, we need to thin. Ideally, edges should be only one point thick. T Non-zero edge width Classification of Points

  23. The Sobel Operators Good Localization Noise Sensitive Poor Detection Sobel (3 x 3): Sobel (5 x 5): Poor Localization Less Noise Sensitive Good Detection

  24. OpenCV Implementation  The Sobel Operators void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 );

  25. OpenCV Implementation  The Scnarr Operator void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); aperture_size CV_SCHARR

  26. Demonstration

  27. Exercise Download Test Program

  28. Effects of Noise Consider a single row or column of the image Where is the edge?

  29. Solution: Smooth First

  30. Solution: Smooth First Where is the edge?

  31. Gaussian: Derivative Theorem of Convolution

  32. Derivative Theorem of Convolution saves us one operation.

  33. Optimal Edge Detection: Canny • Assume: • Linear filtering • Additive iidGaussian noise • An "optimal" edgedetector should have: • Good Detection Filter responds to edge, not noise. • Good Localization detected edge near true edge. • Single Response one per edge.

  34. Optimal Edge Detection: Canny • Based on the first derivative of a Gaussian • Detection/Localization trade-off • More smoothing improves detection • And hurts localization.

  35. Stages of the Canny algorithm • Noise reduction Size of Gaussian filter • Finding the intensity gradient of the image • Non-maximum suppression • Tracing edges through the image and hysteresisthresholding High threshold Low threshold

  36. Parameters of Canny algorithm • Noise reduction • Size of Gaussian filter • Finding the intensity gradient of the image • Non-maximum suppression • Tracing edges through the image and hysteresis thresholding • High threshold • Low threshold

  37. OpenCV Implementation  The Canny Operator void cvCanny( const CvArr* img, CvArr* edges, double lowThresh, double highThresh, int apertureSize = 3 );

  38. Example: Canny Edge Detector Download Test Program

  39. Review:Derivatives of Image in 1D • Edges can be characterized as either: • local extrema of I(x) • zero-crossings of 2I(x)  1D image  gradient  Laplacian

  40. Laplacian • A scalar isotropic. • Edge detection: Find all points for which 2I(x, y) = 0 • Nothinning is necessary. • Tends to produce closed edge contours.

  41. Laplacian

  42. Discrete Laplacian Operators

  43. OpenCV Implementation The Discrete Laplacian Operators void cvLaplace( const CvArr* src, CvArr* dst, int apertureSize = 3 );

  44. Example

  45. Laplician for Edge Detection Find zero-crossing on the Laplacian image.

  46. Zero Crossing Detection There is a little bug in the above algorithm. Try to design your own zero-crossing detection algorithm.

  47. Example:Laplician for Edge Detection Download Test Program

  48. Laplacian for Image Sharpening

  49. Example:Laplacian for Image Sharpening Sharpened Image

  50. Laplacian of Gaussian (LoG) Gaussian: