Starting from:

$25

cs 6384 Homework-4

Homework-4
Question 1
g =
1 1 1 1 1
0 1 2 3 4
0 0 0 0 0
2 2 2 2 2
f1 = 1 0 2 f2 =
1 1
0 −1
Q1
Compute g1, h1, g2, where:
g1 = f1 ⊗ g, h1 = f1 ∗ g, g2 = f2 ⊗ g1
Q2
Compute a mask f such that:
g2 = f ⊗ g
Question 2
Write a program that generates a gray-level image of 200 rows and 500 columns. Associate the value
x = (255 ∗ j/499.0) with the pixel at row i and column j. Convert it to a gray level by rounding. How many
distinct values are you able to detect in the image?
(In your answer you need to submit only the number of distinct values that you are observing. Not the
source code.)
Question 3
Write a program that creates the negative image for a given image. Your program should do the following:
• Read an image.
• Display the input image.
• If the image is color, convert it into a gray level image.
• Display the gray level image.
• Compute the “negative” of the gray level image.
• Display the negative image.
• Write the negative image.
You may want to write your program by modifying the example program “GrayImages.py”.

More products