简体   繁体   English

模块 'cv2.cv2' 没有属性 'sift'

[英]module 'cv2.cv2' has no attribute 'sift'

When I try:当我尝试:

sift = cv2.sift()

I get at the end the following:我最后得到以下内容:

AttributeError: module 'cv2.cv2' has no attribute 'sift'

How can I fix it?我该如何解决? Any help would be appreciated任何帮助,将不胜感激

Short answer:简短的回答:

If anyone is getting error while running如果有人在运行时出错

sift = cv2.SIFT_create()

Make sure you have确保你有

  1. Installed the extra modules of opencv: opencv-contrib (GitHub Repo)安装了 opencv 的额外模块: opencv-contrib (GitHub Repo)
  2. Instead of the code above, run this:而不是上面的代码,运行这个:
sift = cv2.xfeatures2d.SIFT_create()

Long answer:长答案:

This may not be the answer to this specific question, but I decide to write this down just in case anyone might find it hlepful like I did.这可能不是这个特定问题的答案,但我决定把它写下来,以防有人像我一样觉得它很糟糕。

I was learning SIFT via Introduction to SIFT (Scale-Invariant Feature Transform) , and trying out the code我正在通过Introduction to SIFT (Scale-Invariant Feature Transform)学习 SIFT,并尝试代码

sift = cv2.SIFT_create()

Which told me the following其中告诉我以下内容

AttributeError: module 'cv2.cv2' has no attribute 'SIFT_create'

(Edit: the default doc version in the link above is 4.4.0-pre. If you switch it to 4.3.0 the doc correctly tell you to call the right method. I suppose this means that SIFT will back to main in the next release of 4.4.0) (编辑: 上面链接中的默认文档版本是 4.4.0-pre。如果您将其切换到 4.3.0,文档会正确地告诉您调用正确的方法。我想这意味着 SIFT 将在下一个4.4.0 发布)

Then I came to this question and in the comment above the link from @Micka gave me the answer, as shown in the short answer.然后我来到了这个问题,在上面的评论中, @Micka 的链接给了我答案,如简短答案所示。 Thank you Micka!谢谢米卡!

PS The patent has actually expired so SIFT is actually free now, but the work of moving SIFT to main modules is yet to be done as of this moment. PS 专利实际上已经过期,所以现在SIFT实际上是免费的,但目前尚未完成将SIFT移至主要模块的工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 模块“cv2.cv2”没有属性“xfeatures2d”,模块“cv2.cv2”没有属性“SIFT” - module 'cv2.cv2' has no attribute 'xfeatures2d' and module 'cv2.cv2' has no attribute 'SIFT' 模块“cv2.cv2”没有属性“PutText” - module 'cv2.cv2' has no attribute 'PutText' 如何修复错误“模块'cv2.cv2'没有属性setMouseCallBack?” - How to fix the error "module 'cv2.cv2' has no attribute setMouseCallBack?" AttributeError:模块'cv2.cv2'没有属性'rectange' - AttributeError: module 'cv2.cv2' has no attribute 'rectange' 模块“cv2.cv2”没有属性“dnn_superres” - module 'cv2.cv2' has no attribute 'dnn_superres' AttributeError: 模块 'cv2.cv2' 没有属性 'release' - AttributeError: module 'cv2.cv2' has no attribute 'release' 接收错误:AttributeError:尝试调用openCV方法时,模块'cv2.cv2'没有属性'CompareHist' - Receiving error: AttributeError: module 'cv2.cv2' has no attribute 'CompareHist' when trying to call a openCV method OpenCV AttributeError 模块 'cv2.cv2' 没有属性 'Tracker_create' - OpenCV AttributeError module 'cv2.cv2' has no attribute 'Tracker_create' 模块“cv2.cv2”没有属性“xfeatures2d”(Opencv 3.4.2.17) - module 'cv2.cv2' has no attribute 'xfeatures2d'(Opencv 3.4.2.17) AttributeError: 模块 'cv2.cv2' 没有属性 'CAP_PROP_ORIENTATION_META' - AttributeError: module 'cv2.cv2' has no attribute 'CAP_PROP_ORIENTATION_META'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM