“AttributeError:module'cv2.cv2'没有属性'xfeatures2d_HarrisplaceFeatureDetector'”(openCV 4.4.0.42,python 3.7)

2024-10-04 11:28:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我知道在使用sift或surf时会发生此错误,但它是为xfeatures2d_HarrisLaplaceFeatureDetector显示的

代码

return {
        'AGAST': cv2.AgastFeatureDetector,
        'KAZE': cv2.KAZE,
        'AKAZE': cv2.AKAZE,
        'FAST': cv2.FastFeatureDetector,
        'BRISK': cv2.BRISK,
        'ORB': cv2.ORB,
        # 'GFTT': cv2.GFTTDetector,
        'HarrisLaplace': cv2.xfeatures2d_HarrisLaplaceFeatureDetector, #throws error here
        'StarDetector': cv2.xfeatures2d_StarDetector
    }

我有以下版本的opencv

opencv-contrib-python         4.4.0.42
opencv-python                 4.4.0.42

Python=3.7


Tags: 代码return错误cv2opencvsurfsift时会