Digital Image Processing - TU Dresdencvweb/teaching/Courses/WS_2014_15/GP… · 1.Image enhancement...

21
Digital Image Processing Einführungspraktikum Computer Vision

Transcript of Digital Image Processing - TU Dresdencvweb/teaching/Courses/WS_2014_15/GP… · 1.Image enhancement...

Digital Image ProcessingEinführungspraktikum Computer Vision

1.Image enhancementGrey level transformations

• Apply a transformation or function T(r) on every pixel r of the image separately and update it with result value s.

© 2008 R. C. Gonzalez & R. E. Woods

1.Image enhancementGrey level transformations

• Common function: • Log function

• s = c.log(1+r)

• c : normalizing constant to keep the value [0-255]

• Has no parameter.

• Alternative form with parameters α :• s = c.log(1+(eα -1)r)

© 2008 R. C. Gonzalez & R. E. Woods

1.Image enhancementGrey level transformations

• Common function: • Power-law function

• s = c. rϒ

• c : normalizing constant to keep the value [0-255]

• One parameter ϒ (gamma)

© 2008 R. C. Gonzalez & R. E. Woods

Exercise 1

• Create an OpenCV program that takes an image (spine.jpg for example) and applies a gray transformation • Log transformation (with parameter α).

• Power-law transformation (with parameter ϒ )

• Another transformation of your choice.

• Contrast stretching.

• Intensity Slicing.

1.Image enhancementGrey level transformations

© 2008 R. C. Gonzalez & R. E. Woods

• A Histogram is a distribution of gray-level in an image.• It can be seen as Probability Distribution Function PDF of

a pixel value in the image.

1.Image enhancementHistogram Equalization

• Probability Density Function PDF

1.Image enhancementHistogram Equalization

© 2007 R. Alan Peters

• Cumulative Distribution Function CDF

1.Image enhancementHistogram Equalization

© 2007 R. Alan Peters

• Histogram equalization T(r) :

• Continues :

• Discrete :

1.Image enhancementHistogram Equalization

1.Image enhancementHistogram Equalization

© 2007 R. Alan Peters

1.Image enhancementHistogram Equalization

© 2007 R. Alan Peters

1.Image enhancementHistogram Equalization

© 2007 R. Alan Peters

Exercise 02-a

• Open the image spine.jpg and plot its histogram and CDF.

• Apply histogram equalization using OpenCV and show the result.

• Implement Histogram matching and then use it to match the histogram of this image to another image of your choice with a nice histogram.

Exercise 02-b

• Open the image rocks.jpg and plot the histogram and CDF of each color channel.

• Apply histogram equalization using OpenCV on each color channel separately and then combine them and show the result image.

• A smarter way to do color image histogram equalization : take the average of the 3 histograms of color channel. Then use histogram matching to match each color channel to the average histogram you computed. Combine the channels and show the result. Compare it to the previous result.

Image Filtering

• Convolution with filter kernels

Image Filtering

• Convolution with filter kernels

Unsharp Mask

Exercise 3

• unsharp masking Kernel• Give a 3 × 3 mask for performing unsharp masking in a

single pass through an image. Demostrate it works with an example.

• Threshold mean filter :• A threshold operation is applied to the median filter

such that the filter is only activated if the data within the filter window contain a grayscale level above some threshold value.

Correlation

• Cross correlation between two images :

Exercise 04: find my dog

• Write an openCV function that computes the correlation between a template image and every patch of same size in the target image.

• Use this to find the location of the patch (dog.jpg) in the image (findMyDog.jpg).

• Don’t use the built in openCV functions for template matching (even though you can look at the tutorials to see how they are used).