$24
This assignment is due by 11:59 p.m. on Friday, January 24. 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 modi es each pixel value u 2 f0; : : : ; 255g of a grayscale image using the following mapping
u
v = 255
(1)
255
to obtain the modi ed pixel value y. The parameter is a user speci ed 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.ti . 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.ti . Try several di erent 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 ltering is an image enhancement technique that is used to sharpen an image. It works by extracting rst 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 speci ed scaling constant. In many cases, the Laplacian lter
2
00:25
01:25
00:25
3
(3)
4
0
0:25
0
5
is used to obtain g(x; y).
Write a Matlab function that sharpens an image through high-boost ltering using the Laplacian lter. 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
ECES 435 - Drexel University
Instructor: Matthew C. Stamm
Use your sharpening function to sharpen the image moon.ti . Try several di erent 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 outo ocus.ti . Try several di erent 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 di erent lters. In class, we discussed both the averaging and the median lter.
Write a Matlab script to denoise the images peppersNoise1.ti and peppersNoise2.ti using both the median lter and the averaging lter. Examine the e ect of using di erent lter window sizes including 3 3 pixels and 5 5 pixels. From your results, what are the advantages or disadvantages of each lter? What are the advantages or disadvantages of changing the lter 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 rst. Write a Matlab script that generates an edgemap from the 3 3 averaging ltered and median ltered versions of peppersNoise1.ti . Create the edgemap by rst calculating the image’s gradient using
the Sobel lters
SX =
2
2
0
2
3
SY =
2
0
0
0
3
(4)
4
1
0
1
5
4
1
2
1
5
1
0
1
1
2
1
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 di erence do you see between the edgemaps of each ltered image? Which lter has better edge preserving properties?
2