CS 519 Assignment 2: Image Processing - Histogram Equalization, Rotation, Convolution, Assignments of Computer Science

A programming assignment for cs 519 - signal and image processing course. The assignment consists of three parts: histogram equalization, image rotation, and image convolution. Students are required to write functions for each part and test them on provided images. The assignment includes instructions for displaying the results and submitting the write-up.

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-t3e
koofers-user-t3e 🇺🇸

5

(2)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 519 — Signal and Image Processing
Program #2
Due date: Friday, April 25, 2003
Programming: This programming assignment consists of three major parts (corresponding to topics dis-
cussed in Chapters 6, 8 and 9 with some of Chapter 7 thrown into part C). Each part can be (but doesn’t
have to be) implemented as a separate program, in which case you would have three subdirectories (such
as prog2a, prog2b, and prog2c) within the directory for this assignment. This assignment will be
submitted online in the same way as was Program #1 (make sure you tar up everything in you assignment
directory, including your write-up and any images, or preferably links to them).
A) Write a function (or class) to perform histogram equalization and test it on the image
/usr/local/classes/cs/cs519/images/mystery.pgm
Display the original image, its histogram, the histogram equalized image, and the equalized histo-
gram. The two images should be displayed side-by-side in a single window (using a QHBox, for
example) with the original image on the left and the equalized image on the right. The two histograms
should also be displayed side-by-side in a single window (but in a different window than the images)
with the original histogram on the left. (10 pts)
B) Write a function that rotates an image around its center by a specified angle. Recall that rotation about
a point (other than the origin) is given by Eq. (16) in Chapter 8 of the textbook. Use backwards map-
ping (i.e., take the inverse of the resulting transformation matrix) and bilinear interpolation. Put the
resulting (rotated) image into an image of size D × D where D is the image diagonal length. Allow the
rotation operation to be applied to the original or rotated image (thus rotating it even further). Display
the rotated image either next to the original or in a separate window. You may choose any full color
(RGB) image that is available in the course’s “images” directory. (Again, to save disk space and
prevent large submissions, try to use symbolic links to images when possible). (15 pts)
C) Write a function that convolves an image I with a convolution kernel. The image
/usr/local/classes/cs/cs519/images/desktop.pgm
is to be convolved with both of the following kernels
10-1 121
gx=20-2 gy=000
1 0 -1 -1 -2 -1
and the two images Ix = I * gx and Iy = I * gy resulting from the two convolutions are to be combined
and scaled (to values between 0 and 255) by computing
where
G
255
Gmax Gmin
------------------------------GG
min
()=
G
Ix
2
Iy
2
+=
pf2

Partial preview of the text

Download CS 519 Assignment 2: Image Processing - Histogram Equalization, Rotation, Convolution and more Assignments Computer Science in PDF only on Docsity!

CS 519 — Signal and Image Processing

Program # Due date: Friday, April 25, 2003

Programming: This programming assignment consists of three major parts (corresponding to topics dis- cussed in Chapters 6, 8 and 9 with some of Chapter 7 thrown into part C). Each part can be (but doesn’t have to be) implemented as a separate program, in which case you would have three subdirectories (such as prog2a, prog2b, and prog2c) within the directory for this assignment. This assignment will be submitted online in the same way as was Program #1 (make sure you tar up everything in you assignment directory, including your write-up and any images, or preferably links to them).

A) Write a function (or class) to perform histogram equalization and test it on the image

/usr/local/classes/cs/cs519/images/mystery.pgm

Display the original image, its histogram, the histogram equalized image, and the equalized histo- gram. The two images should be displayed side-by-side in a single window (using a QHBox, for example) with the original image on the left and the equalized image on the right. The two histograms should also be displayed side-by-side in a single window (but in a different window than the images) with the original histogram on the left. (10 pts)

B) Write a function that rotates an image around its center by a specified angle. Recall that rotation about a point (other than the origin) is given by Eq. (16) in Chapter 8 of the textbook. Use backwards map- ping (i.e., take the inverse of the resulting transformation matrix) and bilinear interpolation. Put the resulting (rotated) image into an image of size D × D where D is the image diagonal length. Allow the rotation operation to be applied to the original or rotated image (thus rotating it even further). Display the rotated image either next to the original or in a separate window. You may choose any full color (RGB) image that is available in the course’s “images” directory. (Again, to save disk space and prevent large submissions, try to use symbolic links to images when possible). (15 pts)

C) Write a function that convolves an image I with a convolution kernel. The image

/usr/local/classes/cs/cs519/images/desktop.pgm

is to be convolved with both of the following kernels

1 0 -1 1 2 1 gx = 2 0 -2 gy = 0 0 0 1 0 -1 -1 -2 -

and the two images Ix = I * gx and Iy = I * gy resulting from the two convolutions are to be combined and scaled (to values between 0 and 255) by computing

where

G ′

G (^) maxG (^) min

= ------------------------------^ ( GG (^) min )

G = I (^) x^2 + I (^) y^2

and Gmin and Gmax are the minimum and maximum pixel value found in G , respectively ( pts). To avoid dealing with image boundary conditions (where the kernel would extend beyond the boundary of the source image), let Ix and Iy be 2 pixels smaller in both their width and height than the original image I. Display G’ (either next to I or in a separate window) and write it out to your local directory as “gradient.pgm”.

Write-up: Submit a write-up describing how you implemented this programming assignment. Describe in this write-up possible problems that may occur in applying histogram equalization to color (RGB) images. Rotate an image in 15 degree increments to achieve a 120 degree rotation. Compare this in your write-up with a single rotation of 120 degrees (What happens and why?). Also, discuss where and why G’ (resulting from the convolution operation) failed to produce a high output for some object boundary locations. Write-ups are to be submitted as either a Microsoft Word (.doc), Postscript (.ps) or PDF (.pdf) file (20 pts).