Lecture 05 roger s gaborski
This presentation is the property of its rightful owner.
Sponsored Links
1 / 31

Introduction to Computer Vision PowerPoint PPT Presentation


  • 73 Views
  • Uploaded on
  • Presentation posted in: General

Lecture 05 Roger S. Gaborski. Introduction to Computer Vision. Quiz Review In Class Exercise Correlation – Convolution Filtering. Example. Histogram PDF  CDF Equalized Image Filtering using Correlation continued. Histogram Equalization.

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

Presentation Transcript


Lecture 05 roger s gaborski

Lecture 05

Roger S. Gaborski

Introduction to Computer Vision

Roger S. Gaborski


Introduction to computer vision

  • Quiz Review

  • In Class Exercise

  • Correlation – Convolution

    • Filtering

Roger S. Gaborski


Example

Example

  • Histogram PDF  CDF Equalized Image

  • Filtering using Correlation continued


Histogram equalization

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)


Histogram equalization1

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


Histogram equalization2

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


Histogram equalization3

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)


Spatial filtering

Spatial Filtering

  • 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 and nonlinear spatial filtering

Linear and Nonlinear Spatial Filtering

  • 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


Introduction to computer vision

Image origin

y

Kernel coefficients

mask

x

Image region under mask

Roger S. Gaborski


Correlation and convolution

Correlation and Convolution

  • 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


Example 1d correlation

Example: 1D 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 0

    • Move w to the right one value, repeat process

    • Continue process for whole length of f

Roger S. Gaborski


Reminder

Reminder

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


Introduction to computer vision

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski


Introduction to computer vision

‘Full’

correlation

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

‘Same’

correlation

etc.

Roger S. Gaborski


Example convolution

Example - Convolution

  • 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


Introduction to computer vision

Chapter 3

www.prenhall.com/gonzalezwoodseddins

This can be simply extend to images

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Introduction to computer vision

Roger S. Gaborski


Linear filtering in matlab

Linear Filtering in MATLAB

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


Parameters

Parameters

  • 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


Matlab function for filtering imfilter

MATLAB function for filtering: imfilter

  • 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


Introduction to computer vision

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Roger S. Gaborski


Example smoothing

Example:Smoothing

  • 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


Introduction to computer vision

Chapter 3

www.prenhall.com/gonzalezwoodseddins

Input Default padding ‘replicate’

‘symmetric’ ‘circular’ ‘replicate’, uint8

Roger S. Gaborski


  • Login