Download presentation
Presentation is loading. Please wait.
Published byBerniece Bridget Sanders Modified over 9 years ago
1
1 Computational Vision CSCI 363, Fall 2012 Lecture 6 Edge Detection
2
2 Stages for Edge Detection Detecting Edges: Smoothing--Eliminates noise. Determines spatial scale. Differentiation--Localizes the intensity change Feature Extraction: Determine the feature that caused the intensity change.
3
3 Smoothing
4
4 Localization of an edge Changes in intensity are not instantaneous, particularly in a smoothed image. Humans can localize edges to within a few seconds of arc (a few mm for a line a distance of 1 meter from the observer). Accurate localization is necessary for stereo vision. Differentiation allows us to find the location of the most rapid intensity change. The first derivative gives a peak at the location of the most rapid change. The second derivative gives a zero at this location. Marr and Hildreth suggested using these zero crossings to indicate edges.
5
5 Intensity Derivative
6
6 Zero Crossings and Edges Image Image after smoothing and second derivative Black = Negative White = Positive Zero Crossings
7
7 Convolution To smooth a function, we replace the value at each x position with the averaged values around that position. This process is called convolution. Smoothing works best if the average is weighted: nearby neighbors count more, distant neighbors count less. A Gaussian function works well for this weighting. Convolution of I with G is written: G(x) * I(x) For continuous functions:
8
8 The Derivative of a Convolution Gaussian and its derivatives Instead of taking the derivative of a convolution of the image and the Gaussian, we can convolve image with the derivative of the Gaussian
9
9 2 nd Derivative of Gaussian Looks Like... Retinal Ganglion cells and bipolar cells have receptive fields that exhibit a center-surround structure.
10
10 A 2D Gaussian For a 2D image, I(x, y), we convolve with a 2D Gaussian: To differentiate, we use the Laplacian operator: looks like a center surround receptive field. can be approximated by G( 1, x, y) - G( 2, x, y) (A "Difference of Gaussians" or DOG)
11
11 Difference of Gaussians Note: A single retinal ganglion cell cannot distinguish between a zero crossing and uniform intensity. To find edges, one must evaluate the difference in responses of neighboring cells.
12
12 Detecting Edges with Discrete Samples Normally, images will be a group of discrete values: 14 7 2 5 9 27 6 5 18 15 9 2 7 25 2D Image 1D Image We use an approximation of convolution to perform the smoothing and differentiation.
13
13 Smoothing a 1D array Image: 1 3 6 4 5 2 3 6 6 3 1 1 Operator: 1 3 5 3 1 Position 1: 1x1 + 3x3 + 6x5 + 4x3 + 5x1 = 57 Image: 1 3 6 4 5 2 3 6 6 3 1 1 Operator: 1 3 5 3 1 Position 2: 3x1 + 6x3 + 4x5 + 5x3 + 2x1 = 58 Position: 1 2 3 4 5 6 7 8 Value: 57 58 52 44 50 62 81 43
14
14 Other Operators Averaging: 1/5 1/5 1/5 1/5 1/5 Differentiation: 1 -1 Second Derivative: 1 -2 1 2D Convolution: 0 0 0 2 3 2 0 1 2 1 0 0 0 2 5 5 0 3 8 8 0 1 3 3 1 * =
15
15 Matlab Matrices Entering a Matrix: >> A = [1 2 3; 4 5 6; 7 8 9] A = 1 2 3 4 5 6 7 8 9 User types Matlab replies >> Image = zeros(4, 5) Image = 0 0 0 0 0 All zeros >> B = ones(3, 4) B = 1 1 All ones >> C = 5*ones(2, 3) C = 5 5 5 All fives
16
16 Accessing Array Values A =1 2 3 4 A(1, 1) = ? A(2, 1) = ? etc. Use a colon to specify a range of values. 4:7 indicates 4 5 6 and 7. A colon by itself indicates an entire row or column. B =1 2 3 4 5 6 7 8 9 B(2:3, 1:2) = ? B(1:2, :) = ? >> A = zeros(3, 3) >> B = [5 6; 7 8] >> A(1:2, 2:3) = B A = ? 1313 4 5 7 8 1 2 3 4 5 6 0 5 6 0 7 8 0 0 0
17
17 Control Flow Conditional Example: if (A(1, 1) < 5) A(1, 1) = A(1, 1) + 1 end For loop example: for i = 1:5 A(i, 1) = 2*i; end Stepping by 2: for i = 2:2:10 A(i, 2) = 3; end Relational operators: == & | ~=
18
18 Matrix Operations Addition and Subtraction are pairwise by element: 1 2 3 4 5 6 7 8 68 10 12 += ? Matrix Multiplication (*) 1 2 3 456456 * = ?32 Pairwise multiplication (.*) 1 2 3 4 5 6 7 8 512 21 32.*= ? Matrix Division (/) (Multiply first matrix by inverse of second) Pairwise Division (./) 1 2 3 4 5.2.4.6.8./= ?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.