EE 569 Digital Image Processing: Homework #3 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

Rate this product

Problem 1: Geometric Modification (50%)
(a) Geometric Transformation (20%)
Three sub-images “lighthouse1.raw” ~ “lighthouse3.raw” as shown in Figure 1(a) were cut out of
an image of a scene containing a lighthouse. The three holes in the image “lighthouse.raw” as
shown in Figure 1(b) are all of size 256×256. Each sub-image is from one of the hole in the image,
but with different scales and orientations. You are asked to fill the holes in “lighthouse.raw”. Write
a program to implement a geometric transformation algorithm to create the filled image of size
512×512.
(a) lighthouse1~3.raw (b) lighthouse.raw
Figure 1. Boat
One possible way to do it is:
1) Find the coordinates of corners in each sub-image denoted by Fi [x,y], i=1,2,3. This must be
done by your program. You will lose points if you do this manually.
2) Design a generic geometric transform (qx, qy) = Xi (px, py) which maps point (px, py) to
point (qx, qy) in the i-th sub-image. Here, you need to combine one or more translation, rotation
and scaling operations together. After the generic geometric transformation, the transformed
i
th sub-image should be a square image with its sides aligned with the horizontal and vertical
axes.
EE 569 Digital Image Processing: Homework #3
Professor C.-C. Jay Kuo Page 2 of 6
3) For scaling-up, implement the interpolation function Θ(·) such that Θ(Fi[Xi (x, y)]) is of size
160 x 160. Drop redundant pixels when scaling-down.
4) Find the coordinates of the holes (specifically the top-left corners). This must be done
by your program.
5) Fill {Θ(Fi[Xi (x, y)]), i = 1,2,3} into the holes to get the final image. You can assume
you know “lighthouse1.raw” goes to the left hole, “lighthouse2.raw” goes to top, and
“lighthouse3.raw” goes to bottom-right.
Hint: Bi-linear interpolation may be needed to generate the pixel value at fractional positions.
(b) Spatial Warping (20%)
You can use the spatial warping technique to create fantastic images. Figure 2 shows an example:
We can warp a square-shaped image (on the left) into another shape (on the right).
(a) square-shaped image (b) warped image
Figure 2. Image warping
Develop a spatial warping algorithm as the one demonstrated in Figure 2 and apply it to the 512 x
512 gray scale image “hat.raw” shown in Figure 3 to obtain a warped image. The height of each
arc in Figure 2(b) is 128, and the tip of the arc should be located at the center line of the image.
Please indicate the reference points to be used and derive the reverse address mapping function that
converts Figure 2(a) to (b).
Figure 3. hat.raw
EE 569 Digital Image Processing: Homework #3
Professor C.-C. Jay Kuo Page 3 of 6
(c) Lens Distortion Correction (10%)
Radial distortion often happens when an image is captured on a non-flat camera’s focal plane. The
relationship between the actual image and its distortion is as follows:
�” = x(1 + �)�+ + �+�, + �-�.)
�” = y(1 + �)�+ + �+�, + �-�.) [1]
where x, y are undistorted pixel locations, K1, K2, K3 are called radial distortion coefficients of the
lens, and �+ = �+ + �+.
To recover the undistorted image, the (x, y), given the (xd, yd), the key lies on finding the inverse
function so that:
� = �(�”, �”)
� = �(�”, �”) [2]
However, there is no exact inverse function for Eq. [1] since the forward mapping from (x, y) to
(xd, yd) is not linear. A common solution is first to project (x, y) to (xd, yd) which ends up in triplets
of (x, y, xd) and (x, y, yd). We then use linear regression (refer to
https://www.mathworks.com/help/matlab/data_analysis/linear-regression.html for further readings
about linear regression) to find the best approximate inverse functions.
You are given the following distorted image (Figure 4.), and given that K1 = -0.3536, K2 = 0.1730,
K3 = 0, please implement the aforementioned method to correct the distortion. You can use third
party tools (MATLAB, Python Scipy, etc.) for the linear regression part.
Figure 4. classroom.raw
EE 569 Digital Image Processing: Homework #3
Professor C.-C. Jay Kuo Page 4 of 6
Problem 2: Morphological Processing (50%)
In this problem, you will implement three morphological processing operations: shrinking, thinning, and
skeletonizing. A pattern table (patterntables.pdf) is attached for your reference. Please show outputs for
all following parts in your report and discuss them thoroughly. Please state any assumptions you make in
your solution.
(a) Basic Morphological Process Implementation (20%)
Please apply the “shrinking”, “thinning”, and “skeletonizing” filters to the 4 pattern images (pattern1-
4.raw), respectively. Show your results and give reasonable explanation.
Figure 5. pattern1~4.raw
(b) Defect Detection and Correction (15%)
One of the applications of morphological processing technique is defection detection. Suppose a deer
image in Figure 6 is designed for product decoration, and it will be enlarged to fit multiple product
sizes later.
Figture 6. deer.raw
For consistent product appeal, image defect detection to insure no black dots in the main deer body is
necessary. Apply morphological process to help determine
1. Whether deer image is defectless.
2. If it is not defectless, where are defect regions? Correct them to white dots then.
EE 569 Digital Image Processing: Homework #3
Professor C.-C. Jay Kuo Page 5 of 6
(c) Object Analysis (15%)
Rice grain inspection is a procedure to define rice quality in the marketplace. Figure 7 is an example image
for rice grain type examination.
Note: You need to convert the incoming RGB image to grayscale image first and then apply morphological
processes. Some pre-processing or post-process may be needed to deal with unwanted dots and holes.
Figure 7. rice.raw
1. Count the total number of rice grains.
2. Compare the size of rice grains. Rank the grain’s size from small to large in terms of type.
EE 569 Digital Image Processing: Homework #3
Professor C.-C. Jay Kuo Page 6 of 6
Appendix:
Problem 1: Geometric image modification
lighthouse.raw 512×512 8-bit gray
lighthouse1.raw 256×256 8-bit gray
lighthouse2.raw 256×256 8-bit gray
lighthouse3.raw 256×256 8-bit gray
hat.raw 512×512 8-bit gray
classroom.raw 1072×712 8-bit gray
Problem 2: Digital Half-toning
pattern1-4.raw 375×375 8-bit gray
deer.raw 691×550 8-bit gray
rice.raw 500x690x3 24-bit color(RGB)
Reference Images
All images in this homework are from the USC-SIPI [1] image database and MPEG-7 Shape Dataset [2].
Reference
[1] http://sipi.usc.edu/database/
[2] http://www.dabi.temple.edu/~shape/MPEG7/dataset.html