Various SURF functions extracted between MATLAB and OpenCV?

I implement an algorithm in OpenCV that I developed in MATLAB. I am writing a unit test for a SURF function extractor in OpenCV, and I want to compare the output of MATLAB with the highlighted SURF functions in OpenCV.

This problem is that using the same parameters for both MATLAB extracts and OpenCV, I get different functions. How is this possible? Are there different ways to implement SURF?

For MATLAB ( http://www.mathworks.com/help/vision/ref/detectsurffeatures.html ) I use:

MetricThresh: 200
NumOctaves: 3
NumScaleLevels: 4
SURFSize: 64

For OpenCV, I use:

HessianThreshold: 200
nOctaves: 3
nOctaveLayers: 4
extended: false
vertical: true

What's going on here? Is there a better way to verify that openCV and MATLAB produce the same extracted SURF functions from the same image?

Thank you for your help!

+4
source share
1 answer

Under the hood, MATLAB uses OpenCV for some computer vision , including SURF detection. If you look in the $matlabroot/bin/$arch folder, you will find the OpenCV shared libraries in addition to the ocv.dll gateway ocv.dll ).

In fact, the same reference document is mentioned in the documentation of both, which means that the parameters of the algorithm have the same value in both frames.

MATLAB

Herbert Bay, Andreas Ess, Tinn Tuytelaars, Luke Van Gul "SURF: Accelerated Reliable Features", "Computer Vision and Image Understanding" (CVIU), Vol. 110, No. 3, pp. 346--359, 2008

Opencv

Bay, H. and Tuytelaars, T. and Van Gool, L. "SURF: Accelerated Reliable Functions", 9th> European Computer Vision Conference, 2006


First, make sure that you use the same parameter values ​​in both, taking into account the default values. Below are the pages of the OpenCV and MATLAB document for reference.

So try the following codes:

In MATLAB:

 >> img = []; % some 2d grayscale image >> pts = detectSURFFeatures(img, 'MetricThreshold',200, ... 'NumOctaves',3, 'NumScaleLevels',4); 

In C ++ OpenCV:

 cv::Mat img; // some grayscale image cv::SURF surf(200.0, 3, 4-2, false, true); cv::Mat mask; // optional mask (unused here) std::vector<cv::KeyPoint> pts; surf(img, mask, pts); 

In addition, MATLAB usually includes an older version of OpenCV (my MATLAB R2013a comes with v2.4.2 files), which can lead to different results from any version of OpenCV that you are using (the latter is currently v2.4.6)

+4
source

Source: https://habr.com/ru/post/1493502/


All Articles