Starting from:

$30

EE569-Homework 3 Geometric Image Modification and Morphological processing Solved

Problem 1: Geometric Image Modification 
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 
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.

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 
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]

 

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 3x3 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.

 

 



 

Figure 4. The lunch room images (left, middle, right.raw) [2]

 

Problem 2: Morphological processingn 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 
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
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.

(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

 

(c) PCB analysis 
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 (patterntables.pdf) is attached for your reference. Please use this pattern table. 

 



Figure 7. PCB.raw

(d) Defect detection 
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 to explain your method in detail in your report.

 

 

Appendix:

Problem 1: Geometric image modification
            Hedwig.raw                512x512
 
24-bit 
 
color(RGB) 
            Raccoon.raw               512x512
 
24-bit 
 
color(RGB)
            bb8.raw                       512x512
 
24-bit 
 
color(RGB)
            left.raw                        480x720
 
24-bit 
 
color(RGB)
            middle.raw                  480x720
 
24-bit 
 
color(RGB)
            right.raw                     480x720

 

Problem 2: Morphological Processing
 
24-bit 
 
color(RGB)
            fan.raw                        558x558
 
8-bit     
 
greyscale
            cup.raw            
356x315
 
8-bit
 
 
greyscale
 
            maze.raw          
558x558
 
8-bit
 
 
greyscale
 
            stars.raw           
480x640
 
8-bit
 
 
greyscale
 
            PCB.raw          
239x372
 
8-bit
 
 
greyscale
 
            GearTooth.raw
250x250
 
8-bit
 
 
greyscale
 
 
 
 
 
 
 
 
 
 
 

More products