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

16
CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann

Transcript of CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Page 1: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

CS 376bIntroduction to Computer Vision

03 / 18 / 2008

Instructor: Michael Eckmann

Page 2: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Today’s Topics• Comments/Questions• Enhancing images (Chap. 5)

– Fourier transform

• Chapter 6

– color histograms

Page 3: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• Can anyone give examples of images that contain high frequencies? Low frequencies?

Page 4: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• high/low frequencies in images

– low frequencies are in constant or near constant areas

– high frequencies are in highly textured areas --- e.g. grass, with lots of abrupt changes in intensities

Page 5: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• What are the basis functions?

– on the board• How to calculate the weights of basis functions?

– just like any other basis

– by the dot product of the image with each basis

– on the board• Let's look here at some simple examples:• http://www.cs.ioc.ee/~khoros2/linear/dft-pulse-example/front-page.html

Page 6: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

A note about assignments/labs• Another assignment is to come real soon --- spend time this week getting

the previous assignments done.

Page 7: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• recall the power spectrum ccd setup from chapter 1

– it integrated all the values in either a wedge or a curved section

• wedge tells us what directions the dominant features in the image have

• curved section tells us how much high low or medium, etc. frequencies there are in the original image

Page 8: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• low pass, high pass, bandpass filtering

– compute DFT of an image

– operate in the frequency domain

– keep only certain areas of the power spectrum

– take IDFT of the altered spectrum in the frequency domain to get an altered image with whatever frequencies you decided to keep in.

Page 9: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

More comments on Fourier transforms

• Let's continue going over the handouts

Page 10: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color and Shading

• I already covered most of what is found in the first 3 sections of chapter 6 earlier this semester.

– read about HSI (aka HSV) color system

• H = hue

• S = saturation

• I (or V) = Intensity (or Value)

• there is an algorithm to convert RGB to HSI in our text

– understand what's the use of YIQ and YUV

Page 11: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms

• One use of histograms is for similarity comparisons. For example, compare the histogram of an input image with some stored image to determine how similar they are.

– let's look at exercise 6.12 on page 200

Page 12: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms

• If our pixels contain 8 bits each for R G and B, we have 24bits which leads to 224 different colors possible for each pixel.

• Would I want to store a histogram with 224 different bins?

– why or why not?

Page 13: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms• If our pixels contain 8 bits each for R G and B, we have 24bits

which leads to 224 different colors possible for each pixel.• Would I want to store a histogram with 224 different bins?

– maybe but if you really only care about how many pixels are red(dish) or blue(ish) etc., but not how many specifically have RGB=200,189,3 then you wouldn't

• Some options

– use only the two highest bits from each of R G and B yielding 26 different bins

– make three different histograms, one for each of R G and B each with say 16 bins (16*3=48 total bins)

– use HSV color space (maybe ignore saturation and only consider Hue and Value or only consider Hue)

Page 14: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms• If when trying to determine if a model (e.g. a car) is in an image

(e.g. of a driveway) the image can contain the model but it might have been taken under different lighting conditions (sunny vs. cloudy or foggy or rainy), at a different angle, or partially obscured by some other object (e.g. a person or a bush) in the image or a host of other problematic things (e.g. distortions, noise).

• color histogram matching is relatively invariant to translation, rotation about the imaging axis, small off-axis rotations, scale, and partial occlusion.

Page 15: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms• To determine some match value between two image's histograms

(say a largish input image and a smallish model image to try to determine if the model image is in the input image) we can do the following:

• compute the intersection of the histograms by

– sum up over all bins the min histogram value in each bin

• then divide this sum by the number of pixels in the model image to get a match value

– this value is not diminished due to background pixel colors in the input image that are not in the model

• the idea is that the higher the match value the more likely the model is contained within the image

Page 16: CS 376b Introduction to Computer Vision 03 / 18 / 2008 Instructor: Michael Eckmann.

Michael Eckmann - Skidmore College - CS 376b - Spring 2008

Color Histograms• Other measures include distance measures where smaller values

(little distance) implies similarity

– sum of absolute value of differences

– ssd = sum of squared differences

– Euclidean distance = sqrt(ssd)

– ...