1 / 31

Introduction to Computer Vision

Lecture 05 Roger S. Gaborski. Introduction to Computer Vision. Quiz Review In Class Exercise Correlation – Convolution Filtering. Example. Histogram PDF  CDF Equalized Image Filtering using Correlation continued. Histogram Equalization.

ronna
Télécharger la présentation

Introduction to Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 05 Roger S. Gaborski Introduction to Computer Vision Roger S. Gaborski

  2. Quiz Review • In Class Exercise • Correlation – Convolution • Filtering Roger S. Gaborski

  3. Example • Histogram PDF  CDF Equalized Image • Filtering using Correlation continued

  4. Histogram Equalization • Consider an image with the following gray level values: • Construct the pdf • Construct the cdf • Equalize the image using the cdf (not histeq)

  5. Histogram Equalization • Consider an image with the following gray level values: • Construct the pdf 1/9 2/9 3/9 4/9 5/9 .1 .2 .3 .4 .5

  6. pdf cdf 1/9 2/9 3/9 4/9 5/9 .1 .2 .3 .4 .5 Histogram Equalization Look Up Table 1/9 2/9 3/9 4/9 5/9 6/9 7/9 8/9 1 cdf probability .1 .2 .3 .4 .5 Gray level value Gray level value

  7. Histogram Equalization • Consider an image with the following gray level values: • Construct the pdf • Construct the cdf • Equalize the image using the cdf (not histeq)

  8. Spatial Filtering • Neighborhood processing • Define center point (x, y) • Perform operations involving only pixels in the neighborhood • Result of operation is response to process at that point • Moving the pixel results in a new neighborhood • Repeat process for every point in the image Roger S. Gaborski

  9. Linear and Nonlinear Spatial Filtering • Linear operation • Multiply each pixel in the neighborhood by the corresponding coefficient and sum the results to get the response for each point (x, y) • If neighborhood is m x n , then mn coefficients are required • Coefficients are arranged in a matrix, called • filter / filter mask / kernel / template • Mask sizes are typically odd numbers (3x3, 5x5, etc.) Roger S. Gaborski

  10. Image origin y Kernel coefficients mask x Image region under mask Roger S. Gaborski

  11. Correlation and Convolution • Correlation • Place mask w on the image array f as previously described • Convolution • First rotate mask w by 180 degrees • Place rotated mask on image as described previously • Convolution = 180 degree rotation + correlation Roger S. Gaborski

  12. Example: 1D Correlation • Assume w and f are one dimensional • Origin of f is its left most point • Place w so that its right most point coincides with the origin of f • Pad f with 0s so that there are corresponding f points for each w point (also pad end with 0s) • Multiply corresponding points and sum • In this case (example on next page) result is 0 • Move w to the right one value, repeat process • Continue process for whole length of f Roger S. Gaborski

  13. Reminder • ‘full’ is the result we obtain from the operations on the previous slide. If instead of aligning the left most element of f with the right most element of w we aligned the center element of w with the left most value of f we would obtain the ‘same’ result, same indicating the result is the same length of the original w Roger S. Gaborski

  14. Chapter 3 www.prenhall.com/gonzalezwoodseddins Roger S. Gaborski

  15. ‘Full’ correlation Roger S. Gaborski

  16. Roger S. Gaborski

  17. Roger S. Gaborski

  18. ‘Same’ correlation etc. Roger S. Gaborski

  19. Example - Convolution • Convolution is the same procedure, but the filter is first rotated 180 degrees. • Convolution = 180 degree rotation + correlation • If the filter is symmetric, correlation and convolution results are the same Roger S. Gaborski

  20. Chapter 3 www.prenhall.com/gonzalezwoodseddins This can be simply extend to images Roger S. Gaborski

  21. Roger S. Gaborski

  22. Roger S. Gaborski

  23. Roger S. Gaborski

  24. Roger S. Gaborski

  25. Roger S. Gaborski

  26. Linear Filtering in MATLAB g = imfilter(f, w, filtering mode, boundary, size) • filters the imput image f with the filter mask w. • f is input image. It can be of any class (logical/numeric) and dimension. • g is output image • filter mode: - 'corr' : correlation, and default mode - 'conv' : convolution Roger S. Gaborski

  27. Parameters • g = imfilter(f, w, filtering mode, boundary, size) Boundary options - X pad boundary with value X. Default X = 0. - 'symmetric' symmetric padding - 'replicate' replicate padding - 'circular' circular padding Size options - 'same' g is the same size of f (default mode) - 'full' g is full filtered by w, so size of g is increased Roger S. Gaborski

  28. MATLAB function for filtering: imfilter • g = imfilter(f, w, ‘replicate’) • Correlation is the default filtering mode. • If filters are pre-rotated 180 degrees, can simply use default(corr) for convolution • If filter is symmetric, doesn’t matter Roger S. Gaborski

  29. Chapter 3 www.prenhall.com/gonzalezwoodseddins Roger S. Gaborski

  30. Example:Smoothing • w = ones(31); (31x31 filter) • % Normally the coefficients (w) are scaled to sum to one • % In this example only coefficients are not scaled by 312 • % Convolution should result in a blurred result • gd = imfilter(f, w); • % Default mode: correlation filtering • imshow(gd, [ ]); Roger S. Gaborski

  31. Chapter 3 www.prenhall.com/gonzalezwoodseddins Input Default padding ‘replicate’ ‘symmetric’ ‘circular’ ‘replicate’, uint8 Roger S. Gaborski

More Related