1 / 85

Introduction to Computer Vision

Introduction to Computer Vision. Lecture 5 Dr. Roger S. Gaborski. Example. Histogram PDF  CDF Equalized Image Filtering using Correlation continued. Histogram Equalization. Consider an image with the following gray level values: Construct the pdf Construct the cdf

jael-little
Download Presentation

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. Introduction to Computer Vision Lecture 5 Dr. Roger S. Gaborski

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

  3. 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)

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

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

  6. 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)

  7. Chapter 3 www.prenhall.com/gonzalezwoodseddins

  8. Example - 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 zero • Move w to the right one value, repeat process • Continue process for whole length of f

  9. ‘Full’ correlation

  10. ‘Same’ correlation etc.

  11. Noise Issues • g(x,y) = f(x,y) + n(x,y) • Where • f(x,y) is the original image • n(x,y) is the noise term (see text, page 143 for different types of noise) • How does noise affect the image? • Can we remove the effects of noise?

  12. Sources of Noise • Sensor (thermal, other) • Electronic circuitry noise • Transmission noise

  13. Standard Deviation • Statistics – analyzing data sets in terms of the relationships between the individual points • Standard Deviation is a measure of the spread of the data [0 8 12 20] [8 9 11 12] • Calculation: average distance from the mean of the data set to a point s = Σi=1n(Xi – X)2 (n -1) • Denominator of n-1 for sample and n for entire population

  14. Standard Deviation • For example [0 8 12 20] has s = 8.32 [8 9 11 12] has s = 1.82 [10 10 10 10] has s = 0

  15. Variance • Another measure of the spread of the data in a data set • Calculation: s2 = Σi=1n(Xi – X)2 (n -1) Why have both variance and SD to calculate the spread of data? Variance is claimed to be the original statistical measure of spread of data. However it’s unit would be expressed as a square e.g. cm2, which is unrealistic to express heights or other measures. Hence SD as the square root of variance was born.

  16. Gaussian Noise

  17. Histogram of Noise n(x) = (1 / 22 ) * exp( -(x-u)2 / 2) where  is standard deviation and u the mean

  18.  Controls the Width of the Bell-shaped Curve • Integral under curve is 1 Small  Large 

  19. 2 D Gaussian

  20. Data sig=ones([1 1000]); figure, stem(sig(1:15)),axis([0 15 0 2])

  21. Data + Gaussian Noise

  22. Data + Gaussian Noise

  23. Averaging • Averaging will smooth the signal • smoothData(i) = noisyData(i-1)+noisyData(i)+noisyData(i+1) 3

  24. Result of 3 Point Averaging Noisy Input Averaging with 3 Components First two responses due to edge effects (padded with zeros)

  25. Image + Noise

  26. Data from Row 300 Note: Noise values (amplitude) varies rapidly – high frequency component

  27. Can We Recover the Original Image from the Noisy Image? Noisy Input Three Point Averaging

  28. Smoothed Noisy Image

  29. Simple Averaging Filter • Averaging is effective a low pass filter. High frequency noise fluctuations are ‘blocked’ by the filter. • This can be an issue for fine detail. Fine detail in image will also be smoothed. • Tradeoff between keeping fine details in image and reducing noise.

  30. Compare Original and Filtered Images

  31. Absolute Value of Original and Filtered Images

  32. Thresholded Diff Image Details lost by low pass filtering

  33. ‘Smart’ SmoothingorNoise Filtering

  34. Nagao-Matsuyama FilterAn Attempt to Keep Fine Detail • Uses 9 5x5 windows (defined on next slide). • Each 5x5 window has a distinct subwindow defined • Calculate the variance for the pixels in each subwindow • Output is the mean of the pixels in the subwindow that has the lowest variance

  35. Nagao-Matsuyama Filter Average pixel values under red pixels. Calculate the corresponding variance. Use the filter with the smallest variance.

  36. Nagao-Matsuyama Filter • Why does this make sense?? • Why minimum variance?? • When would a block of image data have high variance?? • Low variance??

  37. How Could You Implement This Filter? Want to calculate variance of pixels in image where 1’s are located in filter Cannot use imfilter

  38. Implementation • B = NLFILTER(Image,[5 5],FUN) applies the function FUN to each 5-by-5 sliding block of A. FCN 1.Calculate variance for each filter 2.Choose filter with smallest variance 3.Calculate average with chosen filter (scaled by number of 1’s )

  39. Recall: Variance • Calculation: s2 = Σi=1n(Xi – X)2 (n -1)

  40. Edges • We would like to develop algorithms that detect important edges in images • The ‘quality’ of edges will depend on the image characteristics • Noise can result in false edges

  41. Profiles of an Ideal Edge

  42. Profile of Edge - Analysis • Same gray level input range [0,1] • Edge is located at ‘peak’ of first derivative • Cannot choose only one threshold value because range of first derivative depends on slope of gray level values • The edge is located where the second derivative goes through zero-independent of slope of gray level signal

  43. Edge Detection is Not Simple

  44. The derivative operation can be used to detect edgesHow can the derivative operator be approximated in a digital image??

  45. MATLAB Examples • Approximation to derivative – difference of adjacent data values • data = [ .10 .14 .13 .12 .11 .10 .11 .34 .33 .32 .35 .10 .11 .12 .12 .12]; • diff operator: second- first data value (.14-.10) • diff(data) = 0.04 -0.01 -0.01 -0.01 -0.01 0.01 0.23 -0.01 -0.01 0.03 -0.25 0.01 0.01 0 0 diff operator is approximation to first derivative

  46. Estimate of Second Derivative • diff(diff( data)) • -0.05 0 0.0 0 0.02 0.22 -0.24 0 0.04 -0.28 0.26 0 -0.0100 0

  47. Simulated Data data diff(data) diff(diff(data))

More Related