Python bindings for OpenCV with AttributeError: 'module' object has no attribute 'FeatureDetector_create'

不打扰是莪最后的温柔 提交于 2019-12-11 04:07:16

问题


I am using the python bindings for OpenCV 2.4.X and OpenCV 3.1 but with the following simple two-liner

import cv2
detector = cv2.FeatureDetector_create("SURF")

I get the following output:

Traceback (most recent call last):
   File "version_test.py", line 3, in <module>
    detector = cv2.FeatureDetector_create("SURF")
AttributeError: 'module' object has no attribute 'FeatureDetector_create'

What are the reasons for this error in each version?


回答1:


It seemed that I need opencv-devel and opencv-debuginfo (rpm/deb) packages as well for the 2.4.X version.

Regarding the 3.1 version, these functions have been removed in favor of functions like

detector = cv2.TYPE_create()

where TYPE can be ORB or other detector of your choosing but not SURF and SIFT which have been moved to a nonfree package. For more info check this source.



来源:https://stackoverflow.com/questions/14646692/python-bindings-for-opencv-with-attributeerror-module-object-has-no-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!