1

我目前正在使用来自 vlfeat 的 Dense SIFT。但是我从代码中只得到了一个关键点和描述符。但返回的关键点数量更多。如何提取所有关键点和描述符。

描述符也是一个单一的值,它应该是 128 X 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);
4

1 回答 1

0
for (int i = 0; i < numKeyPoints; i++) {
    cout << vlkeypoints[i].x << endl;
    cout << vlkeypoints[i].y << endl;
}
于 2014-12-03T11:52:28.903 回答