AttributeError: module 'cv2' has no attribute 'xfeatures2d'问题解决

1,923 阅读1分钟

AttributeError: module 'cv2' has no attribute 'xfeatures2d'问题解决

!pip list|grep opencv


opencv-contrib-python         4.6.0.66
opencv-python                 4.6.0.66
img = cv.imread('/home/mw/input/opencv5111/opencv-data/fruits.jpg',0)

# Create SURF object. You can specify params here or later.
# Here I set Hessian Threshold to 400
# 就opencv4.4.0这个版本来说,SIFT方法已经可以直接使用了
# surf = cv.xfeatures2d.SURF_create(400)
surf = cv.SIFT_create(400)