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

标签 python numpy opencv 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: module 'cv2.cv2' has no attribute 'estimateRigidTransform'



我的 openCV 版本是 4.0.0。

最佳答案

estimateRigidTransformdocumentation 所示,此功能已被弃用:

Deprecatd: Use cv::estimateAffine2D, cv::estimateAffinePartial2D instead. If you are using this fuction with images, extract points using cv::calcOpticalFlowPyrLK and then use the estimation fuctions.


cv::estimateAffine2D 应该对噪声更稳健,但比 cv::estimateAffinePartial2D 的计算成本更高。它们与 estimateRigidTransform 类似,其中 fullAffine 参数分别设置为 truefalse

关于python - 如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55757977/

相关文章:

android - 按执行图像处理的按钮后,我的应用程序崩溃了

python - 如何让 "int"解析空白字符串?

python - AppEngine 计费即将发生的变化是否意味着异步批量操作将比当前计费模型便宜得多?

python - 检查一个类是否是 Python 中的数据类

python - 在 fastapi python 中使 Depends 可选

python - RGB LUT 到灰度 - 红外成像

string - 将一串字节转换为 cv::mat

python - 定义仅在矩形子区域中具有非零元素的二维矩阵

python - kwarg-splatting numpy 数组

opencv - VideoCapture 在 OpenCV 2.4.2 中不起作用