written by gooly
I just submitted some Matlab code for object matching, using an old but simple method mentioned in the paper:
Lowe, D.G. 1999. Object recognition from local scale-invariant features.
In International Conference on Computer Vision, Corfu,
Greece, pp. 1150–1157.
This is the original famous SIFT paper. Most people know SIFT points for its robustness and scale, rotation invariant, but many might not notice that an object matching method is also mentioned in the paper.
This Matlab code is based on that method but uses SURF points instead of SIFT. To run the Matlab code you have to download the SURFmex library first. http://www.maths.lth.se/matematiklth/personal/petter/surfmex.php
Remember to include the SURFmex library by right clicking the folder in Matlab and add subfolders to path.
You can then run Demo.m to see the matching result.
Demo.m first calls createTargetModel with a target image and an image with the contour of the target in the same image as input. createTargetModel then gathers the information needed for object matching and output it as targetModel.
matchTarget is then called with the targetModel and the test image as input. The contour of the target in the test image will then be shown.
The algorithm works as follows. First the SURF points of the target image is extracted and stored. In matchTarget.m the SURF points of the test image is also calculated and each of them is matched to the most similar SURF point in the model. By using the scale and orientation of the SURF point descriptor, each matched SURF point pair has a translation from the target image to the test image.
Therefore 1 pair of correctly matched SURF points can decide the position, scale and orientation of the target in the test image. However most of the matched pairs aren’t correct, therefore we use all of the pairs to cast votes on what are the correct position, scale and orientation of the target in the test image.
The result that has the highest votes are then refined. A rotation matrix and a transition vector is then calculated based on the SURF point pairs in the result.