解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘
生活随笔
收集整理的這篇文章主要介紹了
解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題:?AttributeError: module ‘cv2.cv2’ has no attribute ‘estimateRigidTransform’
分析:?出現該問題的原因可能是opencv的版本太高,不存在estimateRigidTransform方法,查看文檔后我們可以發(fā)現,該方法已被棄用,如下表述所示。
根據表述我們可以使用estimateAffine2D和estimateAffinePartial2D兩個方法代替使用,但是到底應該選擇哪一個方法進行替代,還需要看estimateRigidTransform方法的第三個參數fullAffine的取值。
- fullAffine為true表示的是六自由度的仿射變換,對應的方法為estimateAffine2D
- fullAffine為false表示的是四自由度的仿射變換,對應的方法為estimateAffinePartial2D
注意:?使用estimateAffine2D和estimateAffinePartial2D方法需要兩個返回值,第一個返回值對應的是方法estimateRigidTransform的返回值,第二個返回值表示的是內點inliers,它的具體作用尚未得知。
我是直接修改的:
mat_,inlier = cv2.estimateAffine2D(org_pts, target_pts)歡迎關注公眾號:算法工程師的學習日志,獲取算法工程師的學習資料。如果有技術咨詢,提供有償咨詢,聯系qq(1762016542)或者公眾號留言
總結
以上是生活随笔為你收集整理的解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python PIL.Image和Op
- 下一篇: Python 项目依赖包 第三方库 生成