gpt4 book ai didi

python - OpenCV ORB 描述符 : TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)

转载 作者:太空狗 更新时间:2023-10-29 17:09:17 26 4
gpt4 key购买 nike

我遵循了这个简单的 OpenCV Feature Matching example正是:

import cv2

img = cv2.imread('box.png',0) # queryImage
orb = cv2.ORB() # Initiate ORB detector

# find the keypoints and descriptors with ORB
kp1, des1 = orb.detectAndCompute(img, None)

出现以下错误:

TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)

我正在使用 OpenCV 3.3.1

最佳答案

这是一个 OpenCV 版本兼容性问题。只需使用 cv2.ORB_create() 而不是 cv2.ORB()

代码应该是这样的:

import cv2

img = cv2.imread('box.png',0) # queryImage
orb = cv2.ORB_create() # Initiate SIFT detector

# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img, None)

关于python - OpenCV ORB 描述符 : TypeError: Incorrect type of self (must be 'Feature2D' or its derivative),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49971484/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com