opencv函数错误TypeError: Incorrect type of self (must be ‘Feature2D‘ or its derivative)

1、
TypeError: Incorrect type of self (must be ‘Feature2D’ or its derivative)错误

在编辑opencv中fast函数:
fast = cv2.FastFeatureDetector()
时候,会出现上面那个错误。要将函数修改为:
fast = cv2.FastFeatureDetector_create()

这个错误的ORB后面也是要加一个_creat()
其他基本也是后面加一个create

2、 后面还出现一个错误:
img2 = cv2.drawKeypoints(img, kp, color=(255,0,0))

TypeError: drawKeypoints() missing required argument ‘outImage’ (pos 3)

因为这边需要一个输出图像,在kp后面还要一个图像。所以需要定义一个gray,函数变成:

img2 = cv2.drawKeypoints(img, kp, gray, color=(255,0,0))

fast函数总体如图:
opencv函数错误TypeError: Incorrect type of self (must be ‘Feature2D‘ or its derivative)