从OpenCV文档:
C++:void SIFT::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints,
OutputArray descriptors, bool useProvidedKeypoints=false)
参数:
img – Input 8-bit grayscale image
mask – Optional input mask that marks the regions where we should detect features.
keypoints – The input/output vector of keypoints
descriptors – The output matrix of descriptors. Pass cv::noArray()
if you do not need them.
useProvidedKeypoints – Boolean flag. If it is true, the keypoint
detector is not run. Instead, the provided vector of keypoints is
used and the algorithm just computes their descriptors.
我有以下问题:
-
mask
会采取什么值?我的意思是,如果我想删除图像边界附近的关键点,我应该在边框和中心区域给出一个带零的掩码? -
在另一个网页上,我找到了一个不同的方法,它使用方法"detect"来检测关键点,并使用方法"compute"来计算描述符 . 使用函数detect / compute与函数"operator"有什么区别?使用第一种方法,我首先检测关键点而不计算描述符......但是,如果我使用方法"operator"和
useProvidedKeypoints
标志,我如何才能计算关键点? -
此外,在匹配点数方面,蛮力匹配和FLANN匹配之间有什么区别?我需要使用MATLAB的
VL_FEAT
库获得相同的结果...所以我想知道这两种方法中的哪一种更接近
例如,以下Matlab代码为我提供了2546个检测到的关键点
[f1,d1] = vl_sift(frame1_gray);
使用OpenCV:
std::vector<KeyPoint> keypoints;
cv::SiftFeatureDetector detector;
detector.detect(gray1, keypoints);
cout << keypoints.size() << endl;
只是708 !!!
然后,使用SIFT :: operator(),我输入的参数有问题
std::vector<KeyPoint> keypoints;
Mat descriptors;
SIFT S = SIFT();
SIFT::operator(gray1, Mat(), keypoints, descriptors);
1 回答
让我们一个一个回答你的问题:
Mask是您指定的输入图像,以便您可以控制 where 检测到关键点 . 有时,您不希望检测整个图像上的关键点,并且希望本地化您要检测关键点的位置,或者找到图像的 subsection 来捕获关键点 . 这种情况的原因是因为可能需要进行一些预处理来定位图像中的显着区域 . 例如,如果要进行面部识别,则只需要检测面部上的关键点,而不是整个图像 . 因此,您可能需要先了解图像中面部的位置,然后将关键点检测本地化到这些区域 .
检测和计算显然是两回事 . 检测是确定图像中的 which pixel locations 是有效关键点 . 计算 describes 这些特定位置的关键点 . 兴趣点探测器的成功不仅是它们的可重复性和足够强大以便被探测到,而且它的方法使它们变得流行 .
这分别提到了探测器和描述符 . 有一些框架,例如SIFT和SURF,它们都是检测和描述框架 . SIFT / SURF计算128个bin矢量中的方向直方图(粗略地),并且还具有基于高斯差的近似的检测框架 . 如果我可以建议一个链接,请看一下这个链接:Classification of detectors, extractors and matchers - 它们讨论了所有不同的检测器,描述符以及匹配关键点的方法 .
useProvidedKeypoints
(在OpenCV:http://docs.opencv.org/2.4.1/modules/nonfree/doc/feature_detection.html#sift-operator中)标志表示您已经确定了要为其计算描述符的 where in the image 的像素位置 . 因此,SIFT将绕过算法的检测阶段,它将简单地计算那些像素位置的描述符 .