Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SiftDescriptorExtractor

Tags:

opencv

sift

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?

like image 748
morph Avatar asked Jul 24 '11 05:07

morph


2 Answers

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.

like image 182
Jav_Rock Avatar answered Sep 26 '22 00:09

Jav_Rock


  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.
like image 25
Demian Hwang Avatar answered Sep 26 '22 00:09

Demian Hwang