Digital Image Processing - Practice Homework 4 | ECE 533, Assignments of Digital Signal Processing

Material Type: Assignment; Class: Digital Image Processing; Subject: Electrical & Computer Engineer; University: University of New Mexico; Term: Spring 2008;

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-fme-1
koofers-user-fme-1 🇺🇸

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Digital Image Processing ECE 533
Assignment 4
Due date: March 11, in class
Department of Electrical and Computing Engineering,University of New Mexico.
Professor Majeed Hayat, [email protected]
February 27, 2008
1 Image enhancement using intensity transformations
Consider the problem of mapping the normalized intensity levels rk {0,1
L1, . . . , 1}into
the normalized intensity levels sk=rk.
1. Define a class of functions, with parameter γ, γ 0, to implement the transforma-
tions shown in the Figs. 1(a) and (b). Use MATLAB to implement such intensity
transformation.
2. The class of transformations
sk=
1
1+(m/rk)α, α > 0
0, α =and rk< m
1, α =and rkm
,(1)
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.
1
pf3
pf4
pf5

Partial preview of the text

Download Digital Image Processing - Practice Homework 4 | ECE 533 and more Assignments Digital Signal Processing in PDF only on Docsity!

Digital Image Processing ECE 533

Assignment 4

Due date: March 11, in class

Department of Electrical and Computing Engineering, University of New Mexico.

Professor Majeed Hayat, [email protected]

February 27, 2008

1 Image enhancement using intensity transformations

Consider the problem of mapping the normalized intensity levels rk ∈ { 0 , (^) L−^11 ,... , 1 } into the normalized intensity levels sk = rk.

  1. Define a class of functions, with parameter γ, γ ≥ 0, to implement the transforma- tions shown in the Figs. 1(a) and (b). Use MATLAB to implement such intensity transformation.
  2. The class of transformations

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.

3 Bit-level slicing

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]

4 Histogram equalization and histogram specification

  1. Explain why the discrete histogram equalization technique does not, in general, yield a flat histogram (This is Problem 3.5 in [1]).
  2. Consider a digital image with L gray-levels. Recall the histogram-equalization trans- formation, defined by:

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.

  1. Explain the following MATLAB code that implements the histogram equalization given in equation (2).

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(:));

  1. Use this code to perform histogram equalization of the image phobos.jpg and any other images from Problem 1.
  2. Histogram specification or matching: Write a MATLAB code to implement the algorithm proposed in pages 94–101 in the text [1]. Use the histogram specified in the website^1 to perform the histogram specification of the image phobos.jpg. Use the specified histogram to transform other images as well. Comment on your results. What can you do with histogram specification that you cannot do with histogram equalization?
  3. Change the specified histogram thrice to (1) brighten, (2) reduce contrast, and (3) and darken the images. Explain your ideas and comment on your results.

5 Spatial filtering

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.

A Image quality indices.

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.