Loading in 5 sec....

Introduction to Computer VisionPowerPoint Presentation

Introduction to Computer Vision

- 87 Views
- Uploaded on
- Presentation posted in: General

Introduction to Computer Vision

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Lecture 05

Roger S. Gaborski

Roger S. Gaborski

- Quiz Review
- In Class Exercise
- Correlation – Convolution
- Filtering

Roger S. Gaborski

- Histogram PDF CDF Equalized Image
- Filtering using Correlation continued

- Consider an image with the following gray level values:
- Construct the pdf
- Construct the cdf
- Equalize the image using the cdf (not histeq)

- 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

cdf

1/9 2/9 3/9 4/9 5/9

.1 .2 .3 .4 .5

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

- Consider an image with the following gray level values:
- Construct the pdf
- Construct the cdf
- Equalize the image using the cdf (not histeq)

- 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

- 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

Image origin

y

Kernel coefficients

mask

x

Image region under mask

Roger S. Gaborski

- 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

- 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

- ‘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

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski

‘Full’

correlation

Roger S. Gaborski

Roger S. Gaborski

Roger S. Gaborski

‘Same’

correlation

etc.

Roger S. Gaborski

- 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

Chapter 3

www.prenhall.com/gonzalezwoodseddins

This can be simply extend to images

Roger S. Gaborski

Roger S. Gaborski

Roger S. Gaborski

Roger S. Gaborski

Roger S. Gaborski

Roger S. Gaborski

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

- 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

- 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

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski

- 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

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Input Default padding ‘replicate’

‘symmetric’ ‘circular’ ‘replicate’, uint8

Roger S. Gaborski