首页 文章

计算非关键点的SURF / SIFT描述符

提问于
浏览
2

实际上,我正在尝试将从图像中提取的关键点列表与从另一个图像提取的另一个关键点列表进行匹配 . 我尝试使用SURF / SIFT来检测关键点,但结果并不像从每个图像检测到的关键点的准确性那样预期 . 我想不使用关键点检测器,只使用连接区域的点,然后使用SIFT / SUFT计算这些点的描述符,但大多数时候调用计算方法将清空关键点列表 .

代码示例如下:

int minHessian = 100;
 SurfFeatureDetector detector(minHessian);  
Mat descriptors_object;
 SurfDescriptorExtractor extractor;
 detector.detect( img_object, keypoints_object); 
 extractor.compute( img_object, keypoints_object,descriptors_object ); 
 for (int index = 0; index < listOfObjectsExtracted.size(); index ++)
 {
         Mat partOfImageScene = listOfObjectsExtracted[index];
         vector<Point2f> listOfContourPoints = convertPointsToPoints2f(realContoursOfRects[index]);
         vector<KeyPoint> keypoints_scene;
         KeyPoint::convert(listOfContourPoints, keypoints_scene, 100, 1000);
         //detector.detect( partOfImageScene, keypoints_scene );
         if (keypoints_scene.size() > 0)
         {
             //-- Step 2: Calculate descriptors (feature vectors)
             Mat descriptors_scene;
             extractor.compute( partOfImageScene, keypoints_scene, descriptors_scene );
            //Logic of matching between descriptors_scene and descriptors_object 
         } 
}

因此,在步骤2中调用 compute 之后,keypoints_scene大多数时间变为空 . 我知道他们在OpenCV文档中声明了以下内容:

请注意,该方法可以通过删除关键点来修改关键点矢量,使得未定义关键点的描述符(通常这些是图像边界附近的关键点) . 该方法确保ouptut关键点和描述符彼此一致(使得关键点的数量等于描述符行数) .

但无论如何要获得更好的结果?我的意思是对我选择的所有要点都有描述符?我是否违反了应该使用关键点的方式?我应该尝试使用与SIFT / SURF不同的特征提取器来获得我想要的吗?或者预计在OpenCV中实现的每个功能检测器都会遇到同样的问题?

EDITED

我正在使用方法 KeyPoint::convert 从点转换为关键点,我传递100作为大小,1000作为响应 . 您可以在下面看到该方法的详细信息:

//! converts vector of points to the vector of keypoints, where each keypoint is assigned the same size and the same orientation
    static void convert(const vector<Point2f>& points2f,
                        CV_OUT vector<KeyPoint>& keypoints,
                        float size=1, float response=1, int octave=0, int class_id=-1);

作为尺寸,100对我来说很好,不是吗?如果没有,任何方式来获得适合我的情况的最佳 Value ?或者只是凭经验?

EDITED :图片大小为1920 * 1080,这里是sample

而且大多数时候它们都靠近图像的边界 . 这有什么问题吗?

1 回答

  • 1

    我想到了 . 问题出在我计算描述符的方式上,因为正如你在上面的代码中看到的那样,我试图在图像的一小部分而不是图像本身上计算描述符 . 因此,当我把图像本身而不是 partOfImageScene 时,像 extractor.compute( img_scene, keypoints_scene, descriptors_scene ); 这样的工作非常完美,我没有从列表中丢失任何关键点 .

相关问题