Starting from:

$30

COM-SGN.110 EXERCISE 3

The tasks should be completed and presented to TA during the lab session. Do not forget to upload your solutions to Moodle! Questions about exercises should be addressed to the TA personally, through Moodle messages or via email, which can be found on the Moodle page of the course.




Pixel operation



Load the ‘wom1.png’ image. Construct your own histogram with 256 bins and display it in a figure. Avoid using imhist, hist or other built-in MATLAB functions dealing with image histograms. You are allowed to use for loop. (Hint: consider equality operation A == b, where A is a matrix and b is a single number).



Create a new function called ContrastStretch to perform contrast stretching on the input image, so as to expand its range to [0 255]. Avoid using imshow(I, [0 255]). (Hint: Find the minimum and maximum values of the input image and stretch the intensity as shown below)
  







































































Now open ‘man8.png’ and 'wom1.png' and use the new ContrastStretch function to enhance the images. Show the resultant images and corresponding histograms. Discuss the difference with the original ones.



Down sampling



Divide the image mbaboon.bmp into blocks of 4×4 pixels. Replace each block by the intensity of the (2, 2) pixel within the block. The resulting image will have the size four times smaller than the original one. Display the down sampled image. Hint (Use blockproc and anonymous function @ in MATLAB)
 Repeat (a) but replace with the pixel (1, 1) instead.



Repeat (a) but replace with the average intensity over the original block.



Compare the obtained results and discuss what have you learned about sampling from this exercise.







Visual Perception



When you enter a dark theater on a bright day, it takes an appreciable interval of time before you can see well enough to find an empty seat. Which visual process is at play in this situation?







Histogram



Suppose we have an image f ( x , y) and its histogram is hf .




If we transform our image to ( , ) = ( , ) + and ensuring ∈ [0, 255] by applying max (0, ( , )) and min (255, ( ( , )), how would hf become?



If we transform our image to ( , ) = ( , ) × and ensuring the pixel values stay in the same range as in (a), how would hf become?



If we rotate the image f ( x , y) by 90o clockwise, how would hf become?

More products