module 'cv2.cv2' has no attribute 'xfeatures2d'

这是由于你没有安装 opencv-contrib-python 库导致的,解决方法:

先卸载你的opencv

pip uninstall opencv-python    /     pip3 uninstall opencv

用sift和suft特征提取的时候,xfeature2d在opencv-contrib库中

再装上opencv-contrib-python

pip install opencv-contrib-python==3.4.1.15

(制定版本,不然还是不能用)

然后调试成功,用完后再把opencv装回来就好

你可能感兴趣的:(module 'cv2.cv2' has no attribute 'xfeatures2d')