我目前正在尝试使用 vlfeat-lib 的 dsift-algorithm。但无论我使用哪个值创建过滤器(样本步长、bin 大小),它都会在执行期间为每一帧返回相同数量的关键点(连续帧与相机不同)。关于 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
这对于密集 SIFT 实现是正常的,因为提取的关键点数量仅取决于输入几何参数[1],即步长和图像大小。
参见 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
返回仅由 _vl_dsift_update_buffers
更新的 self->numFrames
,它仅使用几何信息(边界、步长和垃圾桶大小)。
关于c++ - 将 vlfeat 库的 dsift 与 cv::Mat 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15246155/