简体   繁体   English

使用cv :: Mat的vlfeat库的dsift

[英]using dsift of the vlfeat library with cv::Mat

I am currently trying to use the dsift-algorithm of the vlfeat-lib. 我目前正在尝试使用vlfeat-lib的dsift算法。 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). 但无论我使用哪些值创建过滤器(样本步骤,bin大小),它都会在执行期间为每个帧返回相同数量的关键点(连续帧与摄像机不同)。 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: 关于C或C ++用法的文档非常薄,我找不到这些语言的任何好例子。以下是相关代码:

// 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], ie step and image size. 这对于密集的 SIFT实现是正常的,因为提取的关键点的数量仅取决于输入几何参数[1],即步长和图像大小。

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 ). 特征框(关键点)由采样步骤( vl_dsift_set_steps )和采样边界( 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). [1]: vl_dsift_get_keypoint_num返回仅由_vl_dsift_update_buffers更新的self->numFrames ,它仅使用几何信息(边界,步长和bin大小)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM