



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Digital Image Processing; Subject: Electrical & Computer Engineer; University: University of New Mexico; Term: Spring 2008;
Typology: Assignments
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Professor Majeed Hayat, [email protected]
Consider the problem of mapping the normalized intensity levels rk ∈ { 0 , (^) L−^11 ,... , 1 } into the normalized intensity levels sk = rk.
sk =
1+(m/r^1 k )α^ ,^ α >^0 0 , α = ∞ and rk < m 1 , α = ∞ and rk ≥ m
with m ∈ [0, 1], which is plotted in Fig. 1(c), can be used to produce contrast stretching. Implement in MATLAB the contrast stretching operation.
(^00) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
rk
sk^ γ=
γ>
γ<
(^00) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
rk
sk^ γ=
γ>
γ<
(a) (b)
(^00) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
rk
sk
α=4 (^) α=20 α=∞ m=0.
α=
(c) Figure 1: Intensity transformations: (a) Gamma correction; (b) Negative Gamma correc- tion; and (c) Contrast stretching.
Test your codes for the transformations shown in the Figs. 1(a–c) using the sample images available at the following location: http://www.ece.unm.edu/~jpezoa/tmp. Make sure to plot the histogram after you apply the transformation and use it to comment on the quality of the produced image addressing issues such as the dynamic range, dark- ness/brightness concerns, and contrast.
Explain what is meant by bit-level slicing and write a MATLAB code to generate the bit-level slice for the kth bit. What would be the effect on the histogram of an image if we set to zero the lower order bit planes? What would be the effect on the histogram if we set to zero the higher order bit planes? What would be the effect on the histogram if we invert the higher order bit planes? Answer these questions by looking at examples from the set of images considered in problem 1. [Useful command in MATLAB: bitand]
sk = T (rk) =
∑^ k j=
nj n , k^ = 0,^1 ,... , L^ −^1 ,^ (2) where, n is the total number of pixels in the image and nk is the number of pixels that have gray level rk. Show that T (rk) satisfies the conditions required for any histogram equalization transformation, that is (i) T (rk) is single-valued and mono- tonically increasing in the discrete interval [0, L − 1], and (ii) 0 ≤ T (rk) ≤ 1 for rk ∈ [0, L − 1]. Show also that the inverse discrete transformation of (2) satisfies the conditions (i) and (ii) if none of the gray levels rk are missing. Is histogram equalization an example of point processing? Explain.
img1 = imread(’phobos.jpg’); bins1 = 0:255; hist1 = hist(double(img1(:)),bins1)./length(img1(:));
CDF1 = cumsum(hist1); img1eq = zeros(size(img1)); for i = bins img1eq(find(img1==i)) = CDF1(i+1); end img1eq = uint8(255*img1eq); hist1eq = hist(img1eq(:),bins1)./length(img1eq(:));
The purpose of this problem is to compare the performance of the linear and the order- statistics spatial filters under two different scenarios. Pick some sample image, and using the MATLAB command imnoise generate two noisy versions of the image, one with salt and pepper noise and the other with Gaussian white noise. Specify linear and order- (^1) You will find the following files: HistogramV6.mat, HistogramV7.mat, and Histogram.m. The first two files are binary MATLAB files that were saved for MATLAB versions 6.x and 7.x, respectively. Use the command load to open them. The third file is an ASCII file containing the histogram, to load the data use Histogram. The data contained in the files is THE SAME, we saved in three different format to avoid you any problem reading the data. Once you read a file you will load two double variables: z and pz, which contain the gray levels and the frequencies of appearing of the gray levels, respectively.
The roughness parameter ρ is computed for any image I using
ρ(I) , ‖h^1 ∗^ I‖^1 ‖^ I+‖^1 ‖h^2 ∗^ I‖^1 , (3)
where h 1 (i, j) = δi− 1 ,j − δi,j and h 2 (i, j) = δi,j− 1 − δi,j , respectively, δij is the Kronecker delta, ‖I‖ 1 is the `^1 -norm of I, and ∗ represents discrete convolution. Note that ρ is zero for a uniform image and it increases with the pixel-to-pixel variation in the image. The image quality index Q was introduced by Wang and Bovik as a metric to compare two images [3]. The index is designed to regard any image distortion as a combination of three factors: loss of correlation, luminance distortion, and contrast distortion. Mathe- matically, the image quality index Q is defined by [3]
Q = 4 I^1 I^2 σI^1 σI^2 σI^1 I^2 (I^21 + I^22 )(σ^2 I 1 + σ^2 I 2 )
where, I 1 and σ I^21 (I 2 and σ^2 I 2 ) are the spatial sample mean and the spatial sample variance of one image (of the other image), respectively, and σI 1 I 2 is the covariance between the two images. The dynamical range of the index Q is [− 1 , 1] with 1 representing the best performance. Note that the ρ index uses only one image, while the Q-index requires a reference image.