2014-09-28 93 views
1

我目前使用vlfeat的密集SIFT。但是我从代码中只获得了一个关键点&描述符。但返回的关键点数量更多。如何提取所有关键点&描述符。使用vlfeat密集SIFT关键点和描述符提取

另外描述符是一个单一的值,并且它应该是128×N.

的代码如下所示的。

vlkeypoints的大小只有一个。如何提取所有关键点?

img = imread("filename.jpg"); 

    // create filter 
    vlf = vl_dsift_new(img.rows, img.cols, 1, 3); 

    // transform image in cv::Mat to float vector 
    std::vector<float> imgvec; 
    for (int i = 0; i < img.rows; ++i){ 
     for (int j = 0; j < img.cols; ++j){ 
     imgvec.push_back(img.at<unsigned char>(i,j)/255.0f);                                                   
     } 
    } 
    // call processing function of vl 
    vl_dsift_process(vlf, &imgvec[0]); 

    // echo number of keypoints found 
    std::cout << vl_dsift_get_keypoint_num(vlf) << std::endl; 

    // Extract keypoints 
    VlDsiftKeypoint * vlkeypoints; 
    vlkeypoints = vl_dsift_get_keypoints(vlf); 
+0

行之有效的VLFeat版本0.9.17和'vl_dsift_get_keypoint_num(VLF)'是讲理的数量。 – lanpa 2014-09-30 19:58:50

回答

0
for (int i = 0; i < numKeyPoints; i++) { 
    cout << vlkeypoints[i].x << endl; 
    cout << vlkeypoints[i].y << endl; 
}