关于图像识别:CS-659-图像处理解析

54次阅读

共计 4928 个字符,预计需要花费 13 分钟才能阅读完成。

CS 659
Dr. Frank Shih
CS 659 Image Processing
Homework #2
Covering Lectures 4, 5, 6
NOTES: Submit only the homework“solution”(do not include these homework questions) in
Microsoft Word format to http://moodle.njit.edu/ before the above deadline. Absolutely, no late
submission is accepted. First, write your NAME and ID#. Write the answers in your own words
individually. Any plagiarism will post a“ZERO”score or cause a“FAIL”grade.
Submit your answer in a Microsoft Word file. Do not include the questions; just provide the
required MATLAB codes and answers in the file.
Totally, there are 5 questions. Each question is 20 points. Grading policy checks the correctness
and completion of showing resulting images, Matlab codes, and text responses.
Required reading material: HW2R.
Required images: barbara_gray.jpg, lena_256.bmp, text.jpg, njit_logo.jpg, Lin.jpg
NAME:
ID #:
2.1 (20 points)
(a) Refer to Example 2.6 of the reading material HW2R. Hand calculates the convolution and
correlation of the two images A by B shown below. Show step-by-step calculations and both
results. Treat the region outside of A as zero. Use the center pixel of B as the origin. Note: the
resulting convolution and correlation should be the same size as A. Do not use MATLAB for
this.
Image A:
0 1 0 0
1 2 1 3
1 1 0 1
0 1 1 0
Image B:
0 3 0
2 1 0
1 0 1
(b) Refer to Example 3.3 of the reading material HW2R. An image with 8 gray levels is shown in
the following figure. Hand calculate to apply histogram equalization to the image; draw the
histograms before and after equalization, and display the resulting data matrix. Do not use
MATLAB program. Show your step-by-step calculation procedure.
44444
3 4 5 4 3
3 5 5 5 3
3 4 5 4 3
44444
(c) Read the image: barbara_gray.jpg. Use program to divide each pixel value by 3. Now, the image
will look too dark. Then use histogram equalization to the dark image. An example of Matlab
code: x1=imdivide(x,3); x2=histeq(x1); imhist(x1); imhist(x2); Provide your source code, and
Dr. Frank Shih
show four images using subplot into a 2×2 window with title on each. First, the dark image;
second, the resulting equalized image; third, the histogram of the dark image; fourth, the
histogram after equalization.
2.2 (20 points)
Show Matlab code and resulting images.
(a) Read the image: lena_256.bmp. Corrupt the image using‘salt-and-pepper’noise with parameter
0.7 (MATLAB code: imnoise). Now apply a 5 x 5 filter of ones (divided by 25), a 7 x 7 filter of
ones (divided by 49), and a median filter (MATLAB code: medfilt2) of 5 x 5 and 7 x 7 to the
corrupted image. Use subplot to show 6 images in a 3×2 window. Show the original image, the
salt-and-pepper noise image, and four resulting images.
(b) Show two output images. Read the image: lena_256.bmp. First, corrupt the original image using
Gaussian noise with mean 0 and variance 1. Second, corrupt the original image using
salt-and-pepper noise with parameter 0.5.
(c) Show two output images. Read the image: lena_256.bmp. First, the image is blurred by
“motion”blur representing motion in a 11-pixel neighborhood and at 60°. Second, show the
original image is blurred by“out-of-focus”blur with the circle of confusion radius of 11 pixels.
2.3 (20 points)
(a) Let f and g be two matrices as given below. Hand calculates the resulting matrix of using image
matching equation:
f g f g . What is the output pixel value of the exact matching location?
You need show the step-by-step calculation process.
f =
0 1 0
1 1 1
0 1 0
g =
0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 1 1 1 0 0 0 0
0 1 1 1 1 0 0 0
0 0 1 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 1 1 1 0
0 0 0 0 0 1 0 0
(b) Read the image“text.jpg”. Design a template to extract the character“X”. Hint: You can crop
the character image“X”, and perform correlation (imfilter) or the above method for pattern
matching. Or you can design your own method. Show your method, Matlab code, resulting images,
and the row-column position of exacting matching.
Dr. Frank Shih
2.4 (20 points), Image Slicing
(a) Use the image: lena_256.bmp. Perform 4-level quantization. It means the original gray value 0
to 63 is assigned to an output value 0, 64 to 127 is assigned to an output value 64, 128 to 191 is
assigned to an output value 128, and 192 to 255 is assigned to an output value 192. Implement the
4-level quantization and display the quantized image.
(b) Use the image: lena_256.bmp. Perform bit plane slicing. Since it is a 8 bit gray-scale image,
generate and display 8 bit plane images in a subplot. Which bit plane is the most significant one that
describes the general image content?
2.5 (20 points), Image Subtraction
(a) Background subtraction is used to analyze the foreground regions. Show four images in a
subplot. First,“back1.jpg”is a whiteboard image with a mathematical equation written and taken in
very poor illumination conditions. Second,“back2.jpg”is another snapshot of the same whiteboard
without any text on it. Third, compute the absolute difference of these two images. Fourth, use the
complementary image of the previous result to visually reveal the written equation on the
whiteboard. Helper functions: imabsdiff, imcomplement.
(b) Subtractions are also useful to locate the change of blindness. Show four images in a subplot. (1)
and (2),“chng1.jpg”and“chng2.jpg”are two scenes that differ in another time instance. (3)
compute the absolute difference of these two images. (4) use the complementary image of the
previous result to visually reveal the changes even more prominently.
(c) Image subtractions can be used for edge detection (gradient computation). Use the image:
lena_256.bmp. Generate and display images in a subplot: (1) The original image. (2) Subtract a
Gaussian blurred image from the image itself with a kernel of 3 x 3 and variance of 1. (3) Subtract a
Gaussian blurred image from the image itself with a kernel of 10 x 10 and variance of 9. (4)
Subtract the 10 x 10 blurred image from the 3 x 3 blurred image.
WX:codehelp

正文完
 0