Homework Assignment 3 CS696, applied computer vision solved


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


5/5 - (1 vote)

The goal is this problem is to practice the sliding window method for template matching.
Review of sliding window algorithm

Figure 1. Template matching with sliding window. Left: cropped template image; Middle: scaled template image; right: query image.
Given a template image, e.g., left eye, our task is to find the most similar sub-regionin the query image.
To do so, we will exploit all possible sub-regions of the query image, and calculate the similarities between these sub-regions and the template image. The key is how to define the similarity metric.
In the class meeting, we introduced four different metrics.
• Correlation
• Zero-mean correlation
• Sum Square Difference (SSD)
• Normalized Cross Correlation (NCC)
Usually SSD and NCC are better choices.
Image Data
We provide three images (data folder) as query images. You are strongly encouraged to find sample images on your own.
Convert these query images into grayscale. You can visualize your final results in the RGB imagesif you like.
Crop template images from the query images. The size of the template image will be varying, e.g., 10 by 10 pixels, 20 by 20 pixels, 30 by 30 pixels.
Save the center position of each template image in the query image. This will be used to evaluate your template matching algorithm.
Resize the template images with a few factors (e.g.,2, 1, 0.5), and match each of them to the query image.
Once you localized a template image, calculate the Euclidean distance between the estimated locations to the ground-truth location (saved when you cropped the template images), i.e.localization error.
Coding requirement
You will deal with two cases.
Case-1: template matching with fixedscale: match the cropped template to the query image
• Implement the sliding window method for matching a template image to a query image.
• Try to use three different metricsZero-mean correlation, SSD and NCC
• Calculate the localization errors for each metric.
Case-2: template matching with pyramid representation:
• Resize the template images with multiple scaling factors (e.g., 0.5, 1.0, 2.0) to get the pyramid representation of the template image.
• Implement the sliding window method for matchingeach ofthe pyramidimages (scaled image) to the query image.
• Use the metrics Zero-mean correlation, SSD and NCC
• Calculate the localization errors for each metric.

Useful functions
• normxcorr2()
Forbidden functions
• none

In the report you will describe your algorithm and any decisions you made to write your algorithm a particular way. Then you will show and discuss the results of your algorithm.

In the case of this problem set , show the results of your localization results while using different metrics. Calculate and compare the localization errors in each case.

For some cases (e.g. scaled, metrics), you might fail to localize the template images. Please try to explain the reasons.

Also, discuss anything extra you did. Feel free to add any other information you feel is relevant.

How to submit
• Submit your source codes and writeup through SDSU Blackboard
• Two submissions are allowed.