morph
morph

Reputation: 61

SiftDescriptorExtractor

I've got 2 questions about opencv SiftDescriptorExtractor:

  1. How can I convert descriptors from cv::Mat to vector<float* > (i-th row = i-th descriptor)
  2. How can I define size (= dimensionality) of SIFT descriptor?

Yeah, I know about OpenCV reference, however, I'm not able to get it working. Could someone put here minimum working example pls?

Upvotes: 5

Views: 1665

Answers (2)

Jav_Rock
Jav_Rock

Reputation: 22245

1-The conversion:

vector<float*> descriptor;
for(int i; i = 0; i < keypoints.size())
{
    descriptor.push_back(&keypoints.at<float>(i));
}

2-Size of SIFT:

You can't as SIFT algorithm defines the size of the blocks, bins, etc. What can you do? You can code your own sift. This is a hard tack, but I encourage you to try it.

Upvotes: 6

Demian Hwang
Demian Hwang

Reputation: 180

  1. You can access each element of cv::Mat and make vector by your own. This might helpful if you want to know how to access elements of cv::Mat
  2. As I know, there's no way you can do it with SiftDescriptorExtractor provided by OpenCV. But SIFT Implementation of OpenCV taken from http://blogs.oregonstate.edu/hess/code/sift/ So you can modify original code to change descriptor size. By modifying constants of SIFT descriptor bin size, you can change descriptor size. If you want more than that, you should read the code. Code is well commented and based on Lowe's paper 2004 Distinctive Image Feature From Scale-Invariant Keypoints.

Upvotes: 1

Related Questions