Você está na página 1de 3

# Digital Image Processing Problem Set 1 Instructions: Your solutions to the following problems should include clear explanations,

commented source code and a short description of each function. You should test your functions with several input images, besides the ones provided here. Include the input and output images that you used for experimentation and any additional comments you may have about the results. If you discover something interesting, let us know! Please submit your solutions as a single PDF file. Your report should follow the IEEE Transactions format. Problems: For each task experiment in MATLAB to figure out how it should be done and write a .m file which loads the image, displays it, performs the operation and displays and saves the resulting image. 1. First simply open and display the image Moon.bmp in MATLAB. Determine the size of this image. Finally, save a new copy of this image called Moon2.bmp. 2. Write a MATLAB function flipImage, which flips an image either vertically or horizontally. The function should take two input parameters: the matrix storing the image data and a flag to indicate whether the image should be flipped vertically or horizontally. Use this function from the command line to flip the image woman.bmp both vertically and horizontally, which should give the following results.

3. Write a MATLAB program which generates the negative of an image. This means that a new image is created in which the pixel values are all equal to 1.0 minus the pixel value in the original image. When this is used with the image Moon.bmp the results are as follows:

4. Write a MATLAB function averageIntensity, which calculates the average intensity level of an image. From the command line use this function on the image Moon.bmp. 5. Write a MATLAB function thresholdImage which thresholds an image based on a threshold level given as a parameter to the function. The function should take two parameters: the image to be thresholded and the threshold level. The result of the function should be a new thresholded image. This function would be called as follows: ThresholdedMoon = thresholdImage(Moon, 42); Use this new function from the command line on the image Moon.bmp to give images similar to the following:

6. Write a MATLAB function avgIntensityThresholdImage which takes an image as its only parameter and thresholds this image based on the images average intensity value. Hint: Simply write a new function that uses the two functions just written. 7. Write a MATLAB program which subsamples a grayscale image of size 512x512 by factors of 2, i.e., 256, 128, 64 and display your images in a manner similar the figure below (Figure 2.19 from Gonzalez&Woods) . There are multiple ways to do this as discussed in Gonzales&Woods. You may simply sub-sample, average, etc. Describe which you used and why.

8. Keeping your original image resolution reduce the number of gray levels in your image from 256 to 2 in powers of 2 in a manner similar to the figure below (Figure 2.21 from Gonzalez & Woods).