Question

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;
Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top