Tell me more ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I'm writing on a qualitative evaluation study of interest-point-detectors and descriptors. I've read all Mikolajczyk papers as well as most of the surves from Datta et al. etc. Now I'm implementing an evaluation-tool in OpenCV. I'll take to images. One referred as source- and one as comparison-image.

1.) Detectors: Mikolajczyk uses the repeatability-criterion, correspondence count, matching score and an other metric to evaluate the performance of the detector. I would use repeatability and a correspondence count for matched regions.

2.) Descriptors: Here I would use the widely used Recall and Precision on the matched regions to describe the performance of the descriptor.

My question so far: Are these both good metrics for evaluation?

Now I'm trying to implement this is OpenCV and need a good eye from somebody to tell me if this could do. Here I use SURF-Detector and -Descriptor for testing the metrics. Recall and Precision are not implemented yet, but there is a function calculating this.

#include <opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

int startSURF() {

    std::cout << "Starting " << std::endl;
    cv::Mat sourceImage = cv::imread("collection_1/DSCN5205.JPG",
            CV_LOAD_IMAGE_COLOR);
    cv::Mat comparisonImage = cv::imread("collection_1/DSCN5207.JPG",
            CV_LOAD_IMAGE_COLOR);

    if (!sourceImage.data) {
        std::cout << "Source-Image empty" << std::endl;
        return -1;
    } else if (!comparisonImage.data) {
        std::cout << "Comparison-Image empty" << std::endl;
        return -1;
    }

    //Detect keypoint with SURF
    int minHessian = 400;
    cv::Mat sourceMatchedImage, comparisonMatchedImage;
    std::vector<cv::KeyPoint> sourceKeypoints, comparisonKeypoints;

    cv::SurfFeatureDetector surfDetect(minHessian);
    surfDetect.detect(sourceImage, sourceKeypoints);
    surfDetect.detect(comparisonImage, comparisonKeypoints);

    //Calculate the SURF-Descriptor
    cv::SurfDescriptorExtractor surfExtractor;
    surfExtractor.compute(sourceImage, sourceKeypoints, sourceMatchedImage);
    surfExtractor.compute(comparisonImage, comparisonKeypoints,
            comparisonMatchedImage);

    //Flann-Matching   
    cv::FlannBasedMatcher flann;
    std::vector<cv::DMatch> matches;
    flann.match(sourceMatchedImage, comparisonMatchedImage, matches);

    //Repeatability and Correspondence-Counter    
    float repeatability;
    int corrCounter;
    cv::Mat h12;

    std::vector<cv::Point2f> srcK;
    std::vector<cv::Point2f> refK;

    for (int i = 0; i < matches.size(); i++) {
        srcK.push_back(sourceKeypoints[matches[i].queryIdx].pt);
        refK.push_back(comparisonKeypoints[matches[i].queryIdx].pt);
    }

    std::cout << "< Computing homography via RANSAC. Treshold-default is 3" << std::endl;
    h12 = cv::findHomography( srcK,refK, CV_RANSAC, 1 );

    cv::evaluateFeatureDetector(sourceImage, comparisonImage, h12,
            &sourceKeypoints, &comparisonKeypoints, repeatability, corrCounter);

    std::cout << "repeatability = " << repeatability << std::endl;
    std::cout << "correspCount = " << corrCounter << std::endl;
    std::cout << ">" << std::endl;

    std::cout << "Done. " << std::endl;
    return 0;    
}

I'm uncertain if this code works because SURF gets bad repeatability (e.g. 0.00471577) for my testing images with a rotation of almost 45°. Does anybody see a problem with the code?

Is there a way to evaluate the detector without RANSAC? I did not find a yet implemented method for this. Is the default of 3 a good threshold? I could overwrite it but the problem is that a good threshold can only be determined by experimental results. But I need a robust default-value for all detectors.

I think I definitively need the homography. But I never found a way to set the localisation-error ε for the repeatability-measure. Is there a way to set ε?

A lot of questions. I hope I was specific enough but if there is a question please comment and I will do my best to answer in order get help here. I wish you merry Merry Christmas!

[EDIT] Additional Readings: http://www.robots.ox.ac.uk/~vgg/research/affine/

share|improve this question
2  
Hey! Could you provide the links to papers you're talking about? They sound familiar (might read some), but I might skim one paper to re-familiarize myself, but I certainly will not read all papers by an author. Also, we try to keep the programming problems out of the questions: big chunks of program codes are discouraged, while help with algorithms, approaches and pseudo-code is preferred. – penelope Dec 19 '12 at 12:45
2  
Did you see this by Dahl -- comparative evaluation of detector-descriptor combinations? Also, you should edit any relevant information (such as the link you just provided) in the post, while the comments are more for clarification and asking for more info ;) – penelope Dec 19 '12 at 12:53
Nice article. Thanks. I've edited my question. – Mr.Mountain Dec 19 '12 at 12:58
Hey @Mr.Mountain could it be that you mistakenly used matches[i].queryIdx twice for initializing your point vectors? I suppose one should be matches[i].trainIdx. So the correct points are paired. Could you supply a link to those pictures for reproduction purposes? For validating your code it's also helpful to use some sample images which work well with feature based descriptors. – jstr Dec 20 '12 at 15:22
Indeed there mateched[i].trainIdx should be used. I cannot post the pictures because I don't have the rights to do so. But it's a pictured like this (zeitspurensuche.de/05/07bilder/grabwj07.jpg). I have two of them with changing viewpoint and distance. – Mr.Mountain Dec 21 '12 at 13:08

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.