Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 376b Introduction to Computer Vision 03 / 04 / 2008 Instructor: Michael Eckmann.

Similar presentations


Presentation on theme: "CS 376b Introduction to Computer Vision 03 / 04 / 2008 Instructor: Michael Eckmann."— Presentation transcript:

1 CS 376b Introduction to Computer Vision 03 / 04 / 2008 Instructor: Michael Eckmann

2 Michael Eckmann - Skidmore College - CS 376b - Spring 2008 Today’s Topics Comments/Questions Enhancing images (Chap. 5)‏ –Estimating the gradient magnitude and direction –Prewitt and Sobel gradient masks and the idea behind them –use of smoothing prior to edge detection –vectors and operations, basis etc. –Frei-Chen basis

3 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Estimating the gradient Often we want to find boundaries in images and know how sharp the boundaries are and in which direction the boundaries are. Given f(x,y) as our image function, we would like to compute the gradient at pixels [x,y]. The magnitude of the gradient will give us an indication of how sharp a boundary is, and the angle of the gradient will give us the direction. If we want to estimate the magnitude and direction of the gradient (where the maximum change occurs) do the following: –the partial derivative of f w.r.t. x and the partial derivative of f w.r.t y make up the gradient.

4 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Estimating the gradient The partial derivative of f w.r.t. x (f x ) and the partial derivative of f w.r.t y (f y ) make up the gradient. We can estimate these values in a discrete image at pixel x,y: –for f x : take the difference between the pixel at x-1, y and x+1, y and divide by the change in x (2 pixels)‏ –for f y : take the difference between the pixel at x, y-1 and x, y+1 and divide by the change in y (2 pixels)‏ We can get a better estimate if we average these calculations above and below and to the right and left of the pixel in question. Example on the board (figure 5.14)‏ (draw triangle)‏ The magnitude of the gradient is the square root of the sum of the square of the partials The direction of the gradient is the angle which is arctan(f y / f x )‏

5 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Estimating the gradient These lead to the Prewitt masks The Sobel masks come from the same idea but with twice the weight given to the row/col the pixel is in. These masks are shown in figure 5.15 –let me write them on the board and discuss

6 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Smooth before Edge detect Canny edge detection (one of the most popular and successful edge detection schemes) smooths the image with a Gaussian prior to finding the direction and magnitude of the gradients at the pixels. Further processing involves –thinning edges and following them along contours starting at pixels with large gradient magnitudes and continuing as long as the gradient magnitude is above some smaller threshold Our text book has some examples of images and Canny edge detection. Let's look at some other results of the Canny operator with various Gaussians. Canny edge detection is covered in more depth with psuedocode of the algorithm in Chapter 10. We'll cover it more when we get there.

7 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Background vector length of vector sum of vectors (denoted in our text as + in a circle)‏ product of a scalar and a vector dot product of vectors (denoted in our text as a hollow circle)‏ cross product of vectors orthogonal orthonormal basis of vectors

8 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 vectors A vector is a directed line segment that has magnitude (length) and direction. We can define a vector as the difference between two points. (Example on board.)‏ In 2 dimensions: V = P 2 -P 1 = (v x, v y )‏ In 3 dimensions: V = P 2 -P 1 = (v x, v y, v z )‏ Magnitude (length) of a Vector is determined by the Pythagorean theorem: For 2d: |V| = sqrt(v x 2 + v y 2 ) and for 3d: |V| = sqrt(v x 2 + v y 2 + v z 2 )‏ In general it is the sqrt of the sum of the squares of the elements

9 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 vectors Vector addition: V 1 + V 2 = (v 1x +v 2x, v 1y +v 2y, v 1z +v 2z )‏ Scalar multiplication: sV = (sv x, sv y, sv z )‏ Dot product (aka scalar product) of 2 vectors results in a scalar: V 1 ● V 2 = |V 1 | |V 2 |cos θ θ is the (smaller) angle between the two vectors alternatively: V 1 ● V 2 = v 1x v 2x +v 1y v 2y +v 1z v 2z What would be the dot product of two perpendicular vectors (those with the angle between them being 90 degrees)?

10 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 vectors Cross product (aka vector product) of 2 vectors results in a vector: V 1 x V 2 = u |V 1 | |V 2 |sin θ θ is the angle between the two vectors u is a unit vector (length = 1) perpendicular to both V 1 and V 2 u's direction is determined by the right-hand rule Right-hand rule is: with your right hand, grasp the axis perpendicular to the plane of the two vectors and make sure that the direction of your fingers curve from v1 to v2. u's direction is the direction of your thumb. Alternatively: V 1 x V 2 = (v 1y v 2z – v 1z v 2y, v 1z v 2x – v 1x v 2z, v 1x v 2y – v 1y v 2x )‏

11 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Background orthogonal = (perpendicular vectors == the dot product = 0)‏ orthonormal = orthogonal and each have unit length basis of vectors = a set of vectors that are linearly independent and span the vector space –what does linearly independent mean? if a set of vectors V span spans the vector space, then any vector in the space can be represented by a linear combination of the vectors in V span

12 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Basis for 3x3 images One basis for the 3x3 images is simply a set of 9 3x3 images each one with one 1 and 8 zeros, none of which have the 1 in the same place. Another more useful basis is the Frei-Chen basis. –see figure 5.32 in text Every 3x3 image can be specified as a linear combination of the basis matrices.

13 Michael Eckmann - Skidmore College - CS 376 - Spring 2008 Sinusoids as a Basis Fourier theory states that most real surfaces or functions can be represented as a linear combination of sinusoids.


Download ppt "CS 376b Introduction to Computer Vision 03 / 04 / 2008 Instructor: Michael Eckmann."

Similar presentations


Ads by Google