如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗? [英] How to use estimateRigidTransform in OpenCV 3.0 or higher, Is there any other alternative?

查看:391
本文介绍了如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to use estimateRigidTransform function of OpenCV but it throws up an error.

AttributeError Traceback(最近一次调用最后)在3031 #查找变换矩阵---> 32 m = cv2.estimateRigidTransform(prev_pts, curr_pts, fullAffine=False) #仅适用于 OpenCV-3 或更低版本3334 # 提取翻译

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'

AttributeError: module 'cv2.cv2' has no attribute 'estimateRigidTransform'

我的 openCV 版本是 4.0.0.

my openCV version is 4.0.0.

推荐答案

estimateRigidTransform 的 rel="noreferrer">文档,此函数已被弃用:

As indicated in the documentation of estimateRigidTransform, this function has been deprecated:

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

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.

cv::estimateAffine2D should be more robust to noise, but more computationally expensive than cv::estimateAffinePartial2D. They are similar to estimateRigidTransform with the fullAffine parameter set to true or false, respectively.

这篇关于如何在 OpenCV 3.0 或更高版本中使用estimateRigidTransform,还有其他选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆