문제

I am currently trying to use the dsift-algorithm of the vlfeat-lib. But no matter with which values I create the filter (sample step, bin size), it returns the same number of keypoints for every frame during an execution (consecutive frames are different, from a camera). The documentation on C or C++ usage is very thin, and I could not find any good examples for these languages.. Here is the relevant code:

// create filter
vlf = vl_dsift_new_basic(320, 240, 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;
도움이 되었습니까?

해결책

it returns the same number of keypoints for every frame during an execution

This is normal with dense SIFT implementation since the number of extracted keypoints only depends on input geometrical parameters[1], i.e. step and image size.

See the documentation:

The feature frames (keypoints) are indirectly specified by the sampling steps (vl_dsift_set_steps) and the sampling bounds (vl_dsift_set_bounds).

[1]: vl_dsift_get_keypoint_num returns self->numFrames that is only updated by _vl_dsift_update_buffers which uses geometrical information only (bounds, steps and bin sizes).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top