# EE569: Homework #3 solved

\$35.00

## Description

5/5 - (1 vote)

Problem 1: Geometric Image Modification (40%)
In this problem, you will need to apply geometric modification and spatial warping techniques to
do some interesting image processing tricks. Please note that during these operations, you may
need to solve some linear equations to get the matrix parameters.
(a) Geometric warping (Basic: 20%)
Design and implement a spatial warping technique that transforms an input square image into an
output image of a disk-shaped image. An example is given in Figure 1.
Figure 1. Warp the original Panda image to disk-shaped image
The wrapped image should satisfy the following three requirements:
• Pixels that lie on boundaries of the square should still lie on the boundaries of the circle.
• The center of original images should be mapped to the center of warped images.
• The mapping should be reversible, i.e. it is a one-to-one mapping.
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 2 –
Apply the same developed spatial warping algorithm to Hedwig, Raccoon and bb8 images in
Figure 2.
Figure 2. Hedwig, Raccoon and bb8 images
(1) describe your approach as clearly as possible and show the resulting images.
(2) apply the reverse spatial warping to each warped image to recover its original image.
(3) Compare the recovered square image with the original square image. Is there any
difference between two images? If any, explain sources of distortion in detail.
(b) Homographic Transformation and Image Stitching (Basic: 20%)
One can use homographic transformation and image stitching techniques to create panorama that
consisting of multiple images. One example (Taken from MATLAB examples [1]) is shown in
Figure. 3. The left image were taken with an uncalibrated smart phone camera by sweeping the
camera from left to right along the horizon to capture all parts of the building. The right
panorama is the desired output by stitching transformed images.
Figure 3. An example of image stitching to make panorama [1]
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 3 –
This example involves five images to composite. However, the basic principle is to process in
terms of consecutive pair of images. It could be achieved by following these steps:
• Select control points from both images. You can use SIFT/SURF feature detection and
FLANN feature matching to detect control points. You are allowed to use OpenCV
source ONLY for selecting control points, online source refer to [2].
• Apply homographic transformation to find a homograph mapping (described below).
• Wrap one image onto the other using the estimated transformation.
• Create a new image big enough to hold the panorama and composite the wrapped image
into it.
You can composite by simply averaging the pixel values where the two images overlap.
The homographic transformation procedure is stated below. Images of points in a plane, from
two different camera viewpoints, under perspective projection (pin hole camera models) are
related by a homography:
�” = ��%
where � is a 3×3 homographic transformation matrix, �% and �” denote the corresponding image
points in homogeneous coordinates before and after the transform, respectively. Specifically, we
have
&
�”
(
�”
(
�”
(
+ = ,
�%% �%” �%-
�”% �”” �”-
�-% �-” �–
./
�%
�%
1
1
2
�”
�”
3 =

�”
(
�”
(
�”
(
�”
(

To estimate matrix H, you can proceed with the following steps:
• Fix �– = 1 so that there are only 8 parameters to be determined.
• Select four point pairs in two images to build eight linear equations.
• Solve the equations to get the 8 parameters of matrix H.
• After you determine matrix H, you can project all points from one image to another by
following the backward mapping procedure and applying the interpolation technique.
Implement above homographic transformation and stitching techniques to composite the room
images in Figure 4. Show the results and make discussion on the following questions.
(1) How many control points were used? Show the corresponding control points between left
and middle pair, middle and right pair.
(2) How did you select control points? Clearly specify how you use matched feature from
SURF/SIFT to create panorama.
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 4 –
Figure 4. The lunch room images (left, middle, right.raw) [2]
Problem 2: Morphological processing (60%)
In this problem, you will implement three morphological processing operations: shrinking,
thinning, and skeletonizing. A pattern table (patterntables.pdf) is attached for your reference.
state any assumptions you make in your solution.
(a) Basic morphological process implementation (Basic: 18%)
Please apply the “shrinking”, “thinning”, and “skeletonizing” filters to the 4 pattern images (fan,
cup, maze.raw), respectively. Show your results, including intermediate processing result and
give reasonable explanation.
Figure 5. fan.raw, cup.raw, maze.raw [3]
(b) Counting games (Basic: 15%)
Please apply morphological processing to image (stars.raw) and discuss your solution for the
following questions:
(1) Count the total number of stars in the image.
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 5 –
(2) How many different star sizes are present in the image? What is the frequency of these
star sizes?
(Hint: Plot the histogram of the star size with respect to frequency. The star size is the maximum
L2 distance between two pixel (x, y) that belong to the same star.)
(3) Other than basic morphological filters, can you think of other method to do question (1)
and (2)? Explain your algorithm clearly and show your result (Hint will be given in
discussion section.)
Figure 6. stars.raw
A printed circuit board (PCB) is shown in Figure 7. You need to design an image processing
algorithm that uses morphological and logical operations to answer the questions below.
(1) How many holes present in the given PCB? Example for a hole in PCB is shown below:
(2) Find the total number of pathways present in the given PCB? A pathway is a link through
which current can flow. Example of a pathway is shown below:
Please discuss your algorithm, results and analysis in detail. You should also submit your
Matlab/C/C++ programs. State any assumptions you make for this problem. A pattern table sheet

Figure 7. PCB.raw
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 6 –
A binary (black and white) image of an inspective symmetry gear is shown in Figure. 8. There
are 12 gear teeth uniformly distributed around the cylinder of a normal gear. The one in Figure. 8
has two teeth missing. They are located at the lower left and the right positions of the wheel. You
are required to design a morphological processing algorithm for automatic missing teeth
detection.
Figure 8. GearTooth.raw
Hint: You may proceed with the following steps:
• Find and display the center locations for the four black circle holes. Find the center of
this gear.
• Estimate the outside radius of this gear in terms of number of pixels.
• Find the positions of the gear teeth in this gear.
• Find and display the position of the missing teeth.
Note: Your outputs for bullet points 1, 3, and 4 should be images that have black background and
some white marks indicating the corresponding positions.
You may choose to develop your own solution without following the hint given above. You need
Appendix:
Problem 1: Geometric image modification
Hedwig.raw 512×512 24-bit color(RGB)
Raccoon.raw 512×512 24-bit color(RGB)
bb8.raw 512×512 24-bit color(RGB)
left.raw 480×720 24-bit color(RGB)
middle.raw 480×720 24-bit color(RGB)
right.raw 480×720 24-bit color(RGB)
Problem 2: Morphological Processing
fan.raw 558×558 8-bit greyscale
EE569 Digital Image Processing Homework # 3 v1 (02/17/2020)
Professor C.-C. Jay Kuo – 7 –
cup.raw 356×315 8-bit greyscale
maze.raw 558×558 8-bit greyscale
stars.raw 480×640 8-bit greyscale
PCB.raw 239×372 8-bit greyscale
GearTooth.raw 250×250 8-bit greyscale
References:
[1] MATLAB Panorama example: https://www.mathworks.com/help/vision/examples/featurebased-panoramic-image-stitching.html?searchHighlight=stitching&s_tid=doc_srchtitle
[2] OPENCV feature matching example:
https://docs.opencv.org/3.4/d5/d6f/tutorial_feature_flann_matcher.html
[3] lunch rooms from “PASSTA Datasets”, Cvl.isy.liu.se, 2016.
Available: http://www.cvl.isy.liu.se/en/research/datasets/passta/.
[4] MPEG-7 Shape dataset: http://www.dabi.temple.edu/~shape/MPEG7/dataset.html