CS 4670 Introduction to Computer Vision (Fall 2010)

Project 2a: Feature Detection and Matching

Released: Friday, Sep. 24, 2010
Due: Friday, Oct. 8 (8:59pm), 2010
Last Modified: Wednesday, Oct. 6, 2010


Overview

In this project, you will write code to detect discriminating features in an image and find the best matching features in other images. Your features should be reasonably invariant to translation, rotation, illumination, and scale, and you'll evaluate their performance on a suite of benchmark images.

To help you visualize the results and debug your program, we provide a working user interface that displays detected features and best matches in other images. We also provide sample feature files that were generated using SIFT, the current best of breed technique in the vision community, for comparison.

Description

The project has three parts: feature detection, description, and matching.

1. Feature Detection

In this step, you will identify points of interest in the image using the Harris corner detection method. The steps are as follows (see the lecture slides/readings for more details) For each point in the image, consider a window of pixels around that point. Compute the Harris matrix H for that point, defined as

where the summation is over all pixels p in the window. The weights should be chosen to be circularly symmetric (for rotation invariance). A common choice is to use a 3 × 3 or 5 × 5 Gaussian mask . Note that these weights were not discussed in the lecture slides, but you should use them for your computation.

Note that H is a 2 × 2 matrix. To find interest points, first compute the corner strength function

Once you've computed c for every point in the image, choose points where c is above a threshold. You also want c to be a local maximum in at least a 3 × 3 neighborhood.

It is recommended that the image be Gaussian blurred before running Harris corner detection. You can compare these two results.

2. Feature description

Now that you've identified points of interest, the next step is to come up with a descriptor for the feature centered at each interest point. This descriptor will be the representation you'll use to compare features in different images to see if they match.

You should implement MOPS descriptor. In particular, you need to find dominant orientations and orient the patches accordingly, but you can either use max eigenvector or the smoothed gradient. For extra credit, try implementing a better feature descriptor. You can define it however you want, but you should design it to be robust to changes in position, orientation, and illumination. You are welcome to use techniques described in lecture (e.g., using image pyramids), or come up with your own ideas. If you implement scale-space detection, you will receive extra credit as well.

3. Feature matching

Now that you've detected and described your features, the next step is to write code to match them, i.e., given a feature in one image, find the best matching feature in one or more other images. This part of the feature detection and matching component is mainly designed to help you test out your feature descriptor.

The simplest approach is the following: write a procedure that compares two features and outputs a distance between them. For example, you could simply sum the absolute value of differences between the descriptor elements. You could then use this distance to compute the best match between a feature in one image and the set of features in another image by finding the one with the smallest distance. Two possible distances are:

Testing

Now you're ready to go! Using the UI and skeleton code that we provide, you can load in a set of images, view the detected features, and visualize the feature matches that your algorithm computes.

We are providing a set of benchmark images to be used to test the performance of your algorithm as a function of different types of controlled variation (i.e., rotation, scale, illumination, perspective, blurring). For each of these images, we know the correct transformation and can therefore measure the accuracy of each of your feature matches. This is done using a routine that we supply in the skeleton code.

Skeleton Code

Follow these steps to get started quickly:

  1. Download the skeleton code here.
  2. Download some image sets for plotting ROC curves: graf, Yosemite.
  3. Included with these images are some SIFT feature files and image database files.
  4. Download some image sets for benchmark: graf, leuven, bikes, wall.
  5. Included with these images are some SIFT feature files and image database files.

After compiling and linking the skeleton code, you will have an executable Features This can be run in several ways:

To Do

We have given you a number of classes and methods to help get you started. The only code you need to write is for your feature detection methods and your feature matching methods, all in features.cpp. Then, you should modify computeFeatures and matchFeatures in the file features.cpp to call the methods you have written. We have provided a function dummyComputeFeatures that shows how to create the code to detect and describe features, as well as integrate it into the system. The function ssdMatchFeatures implements a feature matcher which uses the SSD distance, and demonstrates how a matching function should be implemented. The function ComputeMOPSFeatures is the main function you will complete, along with the helper functions computeHarrisValues and computeLocalMaxima. You will also implement the function ratioMatchFeatures for matching features using the ratio test.

You can use the following built-in OpenCV functions.

You will also need to generate plots of the ROC curves and report the areas under the ROC curves (AUC) for your feature detecting and matching code (using the 'roc' option of Features.exe), and for SIFT. For both the Yosemite test images (Yosemite1.jpg and Yosemite2.jpg), and the graf test images (img1.ppm and img2.ppm), create a plot with four curves, two using your MOPs features (with both the SSD distance and ratio distances), and the other two using SIFT (with both the SSD and ratio distances; these curves are provided to you in the zip files for Yosemite and graf provided above).

We have provided scripts for creating these plots using the 'gnuplot' tool. Gnuplot is can be download here.

plot.roc.txt: plots the ROC curves for the SSD distance and the ratio test distance. These assume the two roc datafiles are called 'roc1.txt' (for the SSD distance), and 'roc2.txt' (for the ratio test distance). You will need to edit this script if your files are named differently. This script also assumes 'roc1.sift.txt' and 'roc2.sift.txt' are in the current directory (these files are provided in the zip files above). This script generates an image named 'plot.roc.png'.

plot.threshold.txt: plots the threshold on the x-axis and 'TP rate - FP rate' on the x-axis. The maximum of this function represents a point where the true positive rate is large relative to the false positive rate, and could be a good threshold to pick for the computeMatches step. This script generates an image named 'plot.threshold.png.'

Finally, you will need to report the average AUC for your feature detecting and matching code (using the 'benchmark' option of Features.exe) on four benchmark sets : graf, leuven, bikes and wall.

Submission

First, your source code and executable should be zipped up into an archive called 'code.zip', and uploaded to CMS. In addition, turn in a web page describing your approach and results. In particular:

The web-page (.html file) and all associated files (e.g., images, in JPG format) should be placed in a zip archive called 'webpage.zip' and uploaded to CMS.

Extra Credit

Here is a list of suggestions for extending the program for extra credit. You are encouraged to come up with your own extensions as well!