OpenCV Python 和 SIFT 功能
我知道有很多关于 Python 和 OpenCV 的问题,但我没有找到关于这个特殊主题的帮助。
我想从 python OpenCV 中的图像中提取 SIFT 关键点。
我最近安装了 OpenCV 2.3,可以访问 SURF 和 MSER,但不能访问 SIFT。 我在python模块(cv和cv2)中看不到与SIFT相关的任何内容(好吧,我有点撒谎:有2个常量:cv2.SIFT_COMMON_PARAMS_AVERAGE_ANGLE
和cv2.SIFT_COMMON_PARAMS_FIRST_ANGLE
代码>)。
这让我困惑了一段时间。 这是否与 OpenCV 的某些部分用 C 语言而其他部分用 C++ 语言这一事实有关? 有什么想法吗?
PS:我也尝试过 pyopencv (OpenCV <= 2.1 的另一个 python 绑定)但没有成功。
I know there is a lot of questions about Python and OpenCV but I didn't find help on this special topic.
I want to extract SIFT keypoints from an image in python OpenCV.
I have recently installed OpenCV 2.3 and can access to SURF and MSER but not SIFT.
I can't see anything related to SIFT in python modules (cv and cv2) (well I'm lying a bit: there are 2 constants: cv2.SIFT_COMMON_PARAMS_AVERAGE_ANGLE
and cv2.SIFT_COMMON_PARAMS_FIRST_ANGLE
).
This puzzles me since a while.
Is that related to the fact that some parts of OpenCV are in C and other in C++?
Any idea?
P.S.: I have also tried pyopencv (another python binding for OpenCV <= 2.1) without success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不能说这是否是 SIFT 无法通过 OpenCV 2.3 的 Python 获得的原因(正如最初的问题所问的那样)。不过,阻止 SIFT 纳入 OpenCV 的专利已于 2020 年 3 月 6 日到期。
自版本 4.4.0 起,OpenCV 的分布式构建现在包含 SIFT,可通过 Python 中的
cv2.SIFT_create()
访问。有关其使用的更多信息,请参阅文档。
I can't say whether this is the reason SIFT was not available via Python for OpenCV 2.3 (as the original question asks). However, the patent which was preventing SIFT from being included in OpenCV expired on 2020-03-06.
The distributed build of OpenCV now includes SIFT since version 4.4.0, accessible via
cv2.SIFT_create()
in Python.See the documentation for further information on its use.
您可以使用 OpenCV python 绑定计算 SIFT 特征,如下所示:
You can compute SIFT features using OpenCV python bindings as follows:
SIFT 已申请专利,并且不能免费用于商业用途。
但如果您想将其用于教育目的,很简单:
然后您可以这样做
SIFT has been patented and is not free for commercial use.
But if you want to use it for educational purposes, it's simple:
and then you can do
在 ubuntu 上,您可以通过安装此版本的 opencv-contrib 来修复
On ubuntu you can fix with installing this version of opencv-contrib