1

I'm currently using Dense SIFT from vlfeat. But I got only a single keypoint & descriptor out from the code. But the number of keypoints returned was more. How to extract all the keypoints & descriptors.

Also Descriptor was a single value and it should be of 128 X N.

The code is as follows.

The vlkeypoints size was only one. How to extract all the keypoints?

    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);
  • works well on VLFeat version 0.9.17, and `vl_dsift_get_keypoint_num(vlf)` is reasonble number. – lanpa Sep 30 '14 at 19:58

1 Answers1

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