OpenCV-Python密集SIFT [英] OpenCV-Python dense SIFT

查看:107
本文介绍了OpenCV-Python密集SIFT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenCV具有关于生成SIFT描述符的很好的文档,但这是弱SIFT"的版本,其中关键点由原始 Lowe算法. OpenCV示例的内容类似于:

OpenCV has very good documentation on generating SIFT descriptors, but this is a version of "weak SIFT", where the key points are detected by the original Lowe algorithm. The OpenCV example reads something like:

img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

sift = cv2.SIFT()
kp = sift.detect(gray,None)
kp,des = sift.compute(gray,kp)

我要寻找的是强/密集SIFT,它不检测关键点,而是为覆盖图像的一组补丁(例如16x16像素,8像素填充)计算SIFT描述符.据我了解,在OpenCV中有两种方法可以做到这一点:

What I'm looking for is strong/dense SIFT, which does not detect keypoints but instead calculates SIFT descriptors for a set of patches (e.g. 16x16 pixels, 8 pixels padding) covering an image as a grid. As I understand it, there are two ways to do this in OpenCV:

  • 我可以自己将图像划分为网格,然后以某种方式将这些补丁转换为KeyPoints
  • 我可以使用基于网格的特征检测器

换句话说,我必须将sift.detect()行替换为可以提供所需关键点的内容.

In other words, I'd have to replace the sift.detect() line with something that gives me the keypoints I require.

我的问题是OpenCV文档的其余部分(尤其是wrt Python)严重缺乏,因此我不知道如何实现这两个目标.我在C ++文档中看到有用于网格的关键点检测器,但我不知道如何从Python使用它们.

My problem is that the rest of the OpenCV documentation, especially wrt Python, is severely lacking, so I have no idea how to achieve either of these things. I see in the C++ documentation that there are keypoint detectors for grid, but I don't know how to use these from Python.

另一种选择是切换到VLFeat,它具有非常好的DSift/PHOW实现,但是这意味着我必须从python切换到matlab.

The alternative is to switch to VLFeat, which has a very good DSift/PHOW implementation but means that I'll have to switch from python to matlab.

有什么想法吗?谢谢.

推荐答案

您可以在opencv 2.4.6<中使用Dense Sift. 通过名称创建特征检测器.

You can use Dense Sift in opencv 2.4.6 <. Creates a feature detector by its name.

cv2.FeatureDetector_create(detectorType)

cv2.FeatureDetector_create(detectorType)

然后使用"Dense"字符串代替detectorType

Then "Dense" string in place of detectorType

例如:-

dense=cv2.FeatureDetector_create("Dense")
kp=dense.detect(imgGray)
kp,des=sift.compute(imgGray,kp)

这篇关于OpenCV-Python密集SIFT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆