首页 > 解决方案 > 如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗?

问题描述

我想使用 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。

标签: pythonnumpyopencvvideo-processing

解决方案


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

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

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


推荐阅读