DIP Lab 2

advertisement
Lab 2 – Basic Image Processing Techniques
EELE 5426, Digital Image Processig
Dr. H. Elaydi, EE Department
Islamic University of Gaza
Goal: Perform basic image processing operations and histogram algorithms
I. Introduction
This lab covers the basic image processing operations such as: image resizing and rotation,
quantization and histogram algorithms. The results of resizing and quantization on image quality
are displayed and the methods to improve the quality and avoid artifacts are applied. Histogram
techniques show and manipulat the distribution of gray levels in image . In this lab, histogram,
histogram normalization and histogram equalization are applied.
II. Procedures
Select an image of your choice to operate on and save it to your report
Image Resizing (Scaling) and Rotation
1. Look at the Matlab code for the functions: imresize and imrotate e.g. ( input argument,
output argument, options).
2. Write the Matlab code to perform resizing and rotation on an image.
a. Resize the image by two scaling factors: ½ , ¼ and 2 , using nearest neighbor
and bilinear interpolation methods. Apply Zoom-In on areas with details and
observe the differences between the two interpolation methods. Save these
zoom-ins and add them to your report.
b. Resize the image by scaling factor ¼ using bilinear interpolation – once with the
default filter and once without a filter (set the parameter 'Antialiasing' to false).
Discuss the results.
c. Using the ¼ reduced size image and then expand it with scaling factors of 2, 4,
8, 16, 32 and for each scaling factor calculate the Root Mean Square error.
where f is the original image and f ˆ is the resized output image. Perform the
same for both interpolation methods - nearest neighbor and bilinear. Plot the
RMS error vs. the scaling factor for both interpolation methods (on the same
plot) and explain the difference between the plots.
d.
Apply the function imrotate to rotate the selected image of your choice by 30,
45 and -45 degrees using nearest neighbor and bilinear interpolation methods.
3. State the problem that may occur when shrinking an image? Explain how to overcome
this problem.
Image Quantization
4. Look at the Matlab code for the function: quant e.g. ( input argument, output argument,
options).
5. Write a matlab code to perform uniform quantization of the image to N gray levels
(0≤N≤255).
a. Use your function quant to perform uniform quantization on a selected image of
your choice to 4, 8, 16, 32 and 64 gray levels.
b. Attach relevant examples of false contours problem while stating the level of
quantization.
c. Apply the function imnoise on the image before quantization and test the effect
on the false contours problem.
d. Use zero mean Gaussian noise with several values of variance and determine
which value of variances yields the optimal result? Attach examples of the
quantized images with optimal and non-optimal variance values.
6. Based on the results, explain the problem of “false contours” that occurs in image
quantization? Suggest how to reduce this artifact.
Image Histogram
7. Look at the Matlab code for the functions: imhist, imadjust, histeq, imcontrast, brighten,
stretchlim, e.g. ( input argument, output argument, options).
8. Write a matlab code to perform image histogram, histogram stretching, and histogram
equalization.
a. Perform image histogram on a selected image that can be affected by histogram
operations and show the results.
b. Apply contrast stretching on the image.
c. Apply Histogram equalization on the original image. 1. Test these
demonstrations with the image of your choice.
d. Explain when image contrast stretching will have no effects and when image
histogram equalization will have no effects.
9. Explain what happened after each operations and how to solve the negative effects on
the images.
III.

Deliverables
The M-Files containing the script of implementing the required functions and
operations.

Results Images: Original image, resized and rotated images, RMS plot, quantized images,
Histogram of original image, Image produced from histogram stretching, Histogram of image
produced from histogram equalization.
IV.
Lab report
Parts of the report include: Title page (lab # and name of experiment, course name and
code, department name, university name, date, your name), table of contents, abstract,
Introduction with theoretical backgrounds, lab procedures, results, discussion,
conclusion, and references.
Resizing (Scaling) and Rotation: Submit the results of the demonstrations from 1-3 while
showing the selected image of your choice at the beginning. Answer all questions and
give the relevant examples as instructed in this part.
Quantization: Submit the results of the demonstrations from 3-6. Answer all questions
and give the relevant examples as instructed in this part.
Histogram: Submit the results of demonstrations from 7-9. Explain the main difference
between contrast stretching and histogram equalization. Which problem may occur in
histogram equalization and why doesn’t it happen in contrast stretching. Answer all
questions and give the relevant examples as instructed in this part.
Download