ECE 6532 Digital Image Processing Assignment 1 Due date: Friday ...
ECE 6532 Digital Image Processing Assignment 1 Due date: Friday ...
ECE 6532 Digital Image Processing Assignment 1 Due date: Friday ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>ECE</strong> <strong>6532</strong> <strong>Digital</strong> <strong>Image</strong> <strong>Processing</strong><br />
<strong>Assignment</strong> 1<br />
<strong>Due</strong> <strong>date</strong>: Wednesday, September 11<br />
General guidelines<br />
Please submit your answers electronically as a pdf file. Electronic submissions are due at 5 pm on the<br />
specified <strong>date</strong> (email to tolga@sci.utah.edu). Matlab functions you create must be emailed, printouts of<br />
the functions will not be accepted. All materials should be sent in one email with the subject <strong>ECE</strong>6962<br />
<strong>Assignment</strong>. Make sure to put your name on all written and electronic submissions.<br />
MATLAB question guidelines:<br />
• Name the .m files with the same name as the function. For instance, if the question asks you to create<br />
a function named IntensityTransform1, it should be saved in a file named IntensityTransform1.m. If<br />
you write other subfunctions that are used by the main function IntensityTransform1, they should also<br />
be included in the same .m file after the main function.<br />
• You are not allowed to use any functions from the MATLAB <strong>Image</strong> <strong>Processing</strong> Toolbox or any other<br />
toolboxes in your methods. Only functions that are part of the basic MATLAB package may be used.<br />
QUESTIONS<br />
1. Let f be an image with the histogram<br />
p f (z) =<br />
{ 2<br />
255 2 z z ∈ [0, 255]<br />
0 otherwise<br />
Let g be the image that is the result of applying gamma correction s = 1<br />
255 r2 to f. Find the histogram<br />
for g. Assume that both images are continuous valued.<br />
2. Give an intensity transformation function for linearly spreading the intensities of any given image so<br />
the lowest intensity is 0 and the highest is 255.<br />
3. Problem 3.7 from textbook. Assume that the image intensities are continuous valued.<br />
4. Let f(x, y) and g(x, y) be two images with histograms p f and p g , respectively. Let<br />
h(x, y) = 0.5 (f(x, y) + g(x, y)) .<br />
Is the histogram of the image h(x, y) always the average of the histograms p f and p g ? Justify your<br />
answer.<br />
5. Problem 3.11 from textbook.<br />
6. Implement the intensity transform T (r) shown in the figure below as a MATLAB function. Name your<br />
MATLAB function IntensityTransform1.
Your function should take as input an image and 4 parameters r1, r2, s1 and s2. You can assume the<br />
following:<br />
• The input image will be stored in a matrix of type uint8.<br />
• The input image will have intensities in the range r ∈ [0, 255].<br />
• 0 ≤ r1 < r2 ≤ 255 and 0 ≤ s1 ≤ s2 ≤ 255<br />
The output should be the image with the transformed intensities s. The output image should be of<br />
type uint8.<br />
Hint: It is a good idea to convert the input image to type double at the start of your function and<br />
to convert the output image back to type uint8 at the end.<br />
7. For this question you will implement a locally adaptive intensity transform. Name your function<br />
IntensityTransform2. It should take as input an image and two parameters a and b. Divide the image<br />
into a × a blocks starting from coordinates (0, 0). Notice that some blocks at the right and bottom<br />
edges of the image might be smaller than a × a, this is OK.<br />
In each block compute the mean intensity µ and the standard deviation σ. The transform for a given<br />
block will be defined as<br />
(r − µ)b<br />
s = T (r) = 128 + (1)<br />
σ<br />
Also clamp the output s given by this transformation to the range [0, 255]. In other words, if s as<br />
defined above falls below 0 set it to 0. If it exceeds 255, set it to 255. Create an output image such<br />
that each of the blocks are transformed in this way.<br />
Try your method on the image tem2.pgm with the following sets of parameters:<br />
• a = 128, b = 100<br />
• a = 16, b = 100<br />
• a = 128, b = 10.<br />
Answer the following questions:<br />
a) What effect do you observe when by changing a?<br />
b) What effect do you observe when by changing b?<br />
c) From your observations, briefly discuss what in your opinion is an advantage and a disadvantage<br />
of this method as opposed to the one implemented in IntensityTransform1.