Lecture-6-h - Derivatives and Averages Lecture-6...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Derivatives and Averages Lecture-6 Derivatives and Averages • Derivative: Rate of change of some quantity – Speed is a rate of change of a distance – Acceleration is a rate of change of speed • Average (Mean) – The numerical result obtained by dividing the sum of two or more quantities by the number of quantities 1 Derivative df f ( x) - f ( x - Dx) = lim Dx Æ0 = f ¢( x) = f x dx Dx ds v= speed dt dv a= acceleration dt Examples y = x2 + x4 dy = 2 x + 4 x3 dx y = sin x + e - x dy = cos x + (-1)e - x dx 2 Second Derivative df x = f ¢¢( x) = f xx dx y = x2 + x4 dy = 2 x + 4 x3 dx d2y = 2 + 12 x 2 2 dx Discrete Derivative df f ( x) - f ( x - Dx) = lim Dx Æ0 = f ¢( x) dx Dx df f ( x) - f ( x - 1) = = f ¢( x) dx 1 df = f ( x) - f ( x - 1) = f ¢( x) dx (Finite Difference) 3 Discrete Derivative df = f ( x) - f ( x - 1) = f ¢( x) dx df = f ( x) - f ( x + 1) = f ¢( x) dx df = f ( x + 1) - f ( x - 1) = f ¢( x) dx Left difference Right difference Center difference Example F(x)=10 F’(x)=0 Left difference F’’(x)=0 10 0 0 -1 1 1 -1 -1 0 1 10 0 0 10 0 0 20 10 10 20 0 -10 20 0 0 left difference right difference center difference 4 Derivatives in Two Dimensions f ( x, y ) ∂f f ( x, y ) - f ( x - Dx, y ) = f x = lim Dx Æ0 (partial ∂x Dx Derivatives) ∂f f ( x, y ) - f ( x, y - Dy ) = f y = lim Dy Æ0 ∂y Dy ( f x , f y ) Gradient Vector magnitude = ( f x2 + f y2 ) direction = q = tan -1 2 fy fx D f = f xx + f yy = Laplacian Derivatives of an Image Derivative & average È10 Í10 Í I ( x, y ) = Í10 Í Í10 Í10 Î -1 0 1 -1 0 1 -1 0 1 fx 10 10 10 10 10 20 20 20 20 20 20 20 20 20 20 -1 -1 -1 000 111 fy Prewit È0 0 0 20˘ Í0 30 30 ˙ Í 20˙ I x = Í0 30 30 20˙ Í ˙ Í0 30 30 20˙ Í0 0 0 Î 20˙ ˚ 0 0 0 0 0 0˘ 0˙ ˙ 0˙ ˙ 0˙ 0˙ ˚ 5 Derivatives of an Image È10 Í10 Í I ( x, y ) = Í10 Í Í10 Í10 Î 10 10 10 10 10 20 20 20 20 20 20 20 20 20 20 20˘ È0 0 0 20˙ Í0 0 0 ˙ Í 20˙ I y = Í0 0 0 ˙ 20˙ Í Í0 0 0 20˙ ˚ Í0 0 0 Î 0 0 0 0 0 0˘ 0˙ ˙ 0˙ ˙ 0˙ 0˙ ˚ Convolution 6 Convolution (contd) 1 1 h( x, y ) = Â Â f ( x + i, y + j ) g (i, j ) i = -1 j = -1 h ( x, y ) = f ( x, y ) * g ( x, y ) Average n I + I +KIn I= 1 2 = n ÂI i i =1 n 7 Weighted Average n w I + w2 I 2 + K + wn I n I= 11 = n Âw I ii i =1 n Gaussian g ( x) = e x -3 -2 .011 .13 - x2 2o 2 -1 0 1 2 3 .6 1 .6 .13 Standard deviation .011 g(x) 8 2-D Gaussian g ( x, y ) = e -( x2 + y 2 ) 2o 2 s =2 9 2-D Gaussian Gaussian • Most natural phenomenon can be modeled by Gaussian. • Take a bunch of random variables of any distribution, find the mean, the mean will approach to Gaussian distribution. • Gaussian is very smooth function, it has infinite no of derivatives. 10 Gaussian • Fourier Transform of Gaussian is Gaussian. • If you convolve Gaussian with itself, it is again Gaussian. • There are cells in human brain which perform Gaussian filtering. – Laplacian of Gaussian edge detector Carl F. Gauss • Born to a peasant family in a small town in Germany. • Learned counting before he could talk. • Contributed to Physics, Mathematics, Astronomy,… • Discovered most methods in modern mathematics, when he was a teenager. 11 Carl F. Gauss • Some contributions – Gaussian elimination for solving linear systems – Gauss-Seidel method for solving sparse systems – Gaussian curvature – Gaussian qudrature Noise • Image contains noise due to – – – – Lighting variations Lens de-focus Camera electronics Surface reflectance • Remove noise – Averaging – Weighted averaging 12 Example F(x)= n(x)= F~(x)= H(x)= 10 0 10 10 10 5 15 12 10 0 10 12 10 0 10 14 20 3 23 17 20 0 20 21 20 0 20 20 Edge Detection • Find edges in the image • Edges are locations where intensity changes the most • Edges can be used to represent a shape of an object 13 Edge Detection • Images contain noise, need to remove noise by averaging, or weighted averaging • To detect edged compute derivative of an image (gradient) • If gradient magnitude is high at pixel, intensity change is maximum, that is an edge pixel • If Laplacian (second derivative) is zero then at that point the first derivative is maximum, that point is an edge pixel. Edge Detectors • • • • • • Prewit Sobel Roberts Marr-Hildreth (Laplacian of Gaussian) Canny (Gradient of Gaussian) Haralick (Facet Model) 14 Derivatives of an Image P Sobel -1 0 1 -2 0 2 -1 0 1 fx 01 -1 0 Roberts fx -1 - 2 -1 0 0 0 1 2 1 fy 10 0 -1 fy Laplacian of Gaussian • Filter the image by weighted averaging (Gaussian) • Find Laplacian of image • Detect zero-crossings D2 f = f xx + f yy = Laplacian 15 Canny Edge Detector • Filter the image with Gaussian • Find the gradient magnitude • Edges are maxima of gradient magnitude Haralick’s facet Model based Edge detector • Fit a bi-cubic polynomial to a local neighborhood of a pixel • If the second derivative is zero, and the third derivative is negative, then that point is an edge point. 16 ...
View Full Document

This note was uploaded on 06/12/2011 for the course CAP 5415 taught by Professor Staff during the Fall '08 term at University of Central Florida.

Ask a homework question - tutors are online