解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘

42 篇文章 5 订阅
20 篇文章 1 订阅

问题: AttributeError: module ‘cv2.cv2’ has no attribute ‘estimateRigidTransform’
分析: 出现该问题的原因可能是opencv的版本太高,不存在estimateRigidTransform方法,查看文档后我们可以发现,该方法已被弃用,如下表述所示。

Deprecated:
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.

根据表述我们可以使用estimateAffine2DestimateAffinePartial2D两个方法代替使用,但是到底应该选择哪一个方法进行替代,还需要看estimateRigidTransform方法的第三个参数fullAffine的取值。

  • fullAffine为true表示的是六自由度的仿射变换,对应的方法为estimateAffine2D
  • fullAffine为false表示的是四自由度的仿射变换,对应的方法为estimateAffinePartial2D

注意: 使用estimateAffine2DestimateAffinePartial2D方法需要两个返回值,第一个返回值对应的是方法estimateRigidTransform的返回值,第二个返回值表示的是内点inliers,它的具体作用尚未得知。

我是直接修改的:

mat_,inlier = cv2.estimateAffine2D(org_pts, target_pts)

欢迎关注公众号:算法工程师的学习日志,获取算法工程师的学习资料。如果有技术咨询,提供有偿咨询,联系qq(1762016542)或者公众号留言

  • 8
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值