$30
ECES 435
All reports should be submitted as PDFs. Only one
report must be submitted per team, but all team member’s names must appear on the report.
Part 1
In class, we discussed a method to perform image contrast enhancement known as histogram equalization.
There are many other ways to perform contrast enhancement that are commonly used in practice. One important
contrast enhancement operation is known as gamma correction.
To perform gamma correction, a user modifies each pixel value u ∈ {0, . . . , 255} of a grayscale image using the
following mapping
v = 255 ? u
255
?γ
(1)
to obtain the modified pixel value y. The parameter γ is a user specified constant that shapes how the image’s
pixel value histogram is stretched. The value of gamma is always strictly greater than zero.
• Write a Matlab function that performs gamma correction on a grayscale digital image. This function should
accept an image (already read into Matlab) along with the value of γ as inputs and produce a Matlab variable
representing the image in unsigned 8-bit integer format as an output. Please comment your code and append
it to your report.
• Use your gamma correction function to perform contrast enhancement on the image pout.tiff. What happens
if γ 1? What happens to the image and its pixel value histogram if γ < 1? What happens if γ = 1?
• Use your gamma correction function to enhance the low contrast image moonPhobos.tiff. Try several
different values of γ and report the value that you feel works best. Be sure to include your contrast enhanced
image and its pixel value histogram in your report. Additionally, use Matlab’s histogram equalization
function histeq to enhance the image. Compare the results you obtain using gamma correction with the
results you obtain using histogram equalization.
Part 2
High-boost filtering is an image enhancement technique that is used to sharpen an image. It works by extracting
first extracting the high frequency content g(x, y) from f(x, y). This is then scaled and added back to the original
image to obtain the sharpened image fs(x, y) according to the equation
fs(x, y) = f(x, y) + αg(x, y) (2)
where α is a user specified scaling constant. In many cases, the Laplacian filter
0 −0.25 0
−0.25 1 −0.25
0 −0.25 0
(3)
is used to obtain g(x, y).
• Write a Matlab function that sharpens an image through high-boost filtering using the Laplacian filter. This
function should accept an image (already read into Matlab) along with the value of α as inputs and produce
a Matlab variable representing the image in unsigned 8-bit integer format as an output. Please comment
your code and append it to your report.
1
• Use your sharpening function to sharpen the image moon.tiff. Try several different values of α and report
the value that you feel works best. Be sure to include your sharpened image in your report.
• Now use your sharpening function to sharpen the blurry image outoffocus.tiff. Try several different values
of α and report the value that you feel works best. Be sure to include your sharpened image in your report.
Is it possible to completely recover the original in-focus image? Are there any downsides or unintended
artifacts introduced by sharpening the image?
Part 3
An noisy image can be denoised using several different filters. In class, we discussed both the averaging and
the median filter.
• Write a Matlab script to denoise the images peppersNoise1.tiff and peppersNoise2.tiff using both the
median filter and the averaging filter. Examine the effect of using different filter window sizes including 3 ×3
pixels and 5 × 5 pixels. From your results, what are the advantages or disadvantages of each filter? What
are the advantages or disadvantages of changing the filter size? Include your denoised images in your report.
• In many cases, edges must be extracted from a noisy image. If this is necessary, it is important to denoise the
image first. Write a Matlab script that generates an edgemap from the 3 × 3 averaging filtered and median
filtered versions of peppersNoise1.tiff. Create the edgemap by first calculating the image’s gradient using
the Sobel filters
SX =
−1 0 1
−2 0 2
−1 0 1
SY =
−1 −2 −1
0 0 0
1 2 1
(4)
to approximate the gradient in the row and column directions, then by comparing the magnitude of the
gradient to a threshold. Use the same threshold for both images when generating the edgemap. Please
comment your code and append it to your report. What difference do you see between the edgemaps of each
filtered image? Which filter has better edge preserving properties?
2