如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗?

use*_*069 7 python opencv numpy video-processing

我想使用 OpenCV 的estimateRigidTransform 函数,但它抛出了一个错误。

AttributeError Traceback (most recent call last) in 30 31 #Find transformation matrix ---> 32 m = cv2.estimateRigidTransform(prev_pts, curr_pts, fullAffine=False) #will only work with OpenCV-3 or less 33 34 # Extract traslation

AttributeError: 模块 'cv2.cv2' 没有属性 'estimateRigidTransform'

我的 openCV 版本是 4.0.0。

Pau*_*l92 7

如 的文档中所示estimateRigidTransform,此功能已被弃用:

弃用:改用 cv::estimateAffine2D、cv::estimateAffinePartial2D。如果您将此功能用于图像,请使用 cv::calcOpticalFlowPyrLK 提取点,然后使用估计功能。

cv::estimateAffine2D应该对噪声更鲁棒,但比 计算成本更高cv::estimateAffinePartial2D。它们类似于分别设置为或estimateRigidTransformfullAffine参数。truefalse