Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

why opencv 2.4.10 linux, windows version SIFT returns different features?

We have implemented the same code on Linux and Windows platform, but we have got different results. Size and detail of features are different. In Linux for same image we got 187 features but 216 in Windows, and we can't find similar features.

Could anyone encounter this problem? Thank you.

why opencv 2.4.10 linux, windows version SIFT returns different features?

We have implemented the same code on Linux and Windows platform, but we have got different results. Size and detail of features are different. In Linux for same image we got 187 features but 216 in Windows, and we can't find similar features.

Could anyone encounter this problem? Thank you.

my code:

#include <limits>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <time.h>

#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/legacy/legacy.hpp>

using namespace std;
using namespace cv;

FeatureDetector* detector;
DescriptorExtractor* extractor;

void compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors)
{
    // Compute keypoints for the image.
    if (!image.empty()) {
        detector->detect(image, keypoints);
    }

    if( keypoints.empty() )
        return;

    // Compute descriptors for the image.
    extractor->compute(image, keypoints, descriptors);
}

int main(int argc, char *argv[])
{

    string det_type = "SIFT";
    string des_type = "SIFT";
    string image_file = "test.jpg";
   Mat img = imread(image_file , CV_LOAD_IMAGE_GRAYSCALE );
    initModule_nonfree();
    detector = new SiftFeatureDetector(
                                           0, // nFeatures
                                           4, // nOctaveLayers
                                           0.04, // contrastThreshold
                                           10, //edgeThreshold
                                           1.6 //sigma
                                           );

    extractor = new SiftDescriptorExtractor();

    Mat descriptors;
    vector<KeyPoint> keypoints;
    compute( img, keypoints, descriptors);

    return 0;
}