简体   繁体   English

具有摄像机横摇和俯仰校正功能的OpenCV透视变换

[英]OpenCV perspective transform with camera roll and pitch correction

I am performing some perspective transforms on camera images, however in certain cases the roll and pitch of the camera are not zero. 我正在对摄像机图像执行一些透视变换,但是在某些情况下,摄像机的滚动和俯仰不为零。 In other words, the camera is not level and I would like to be able to correct for this. 换句话说,相机没有水平,我希望能够对此进行校正。

I have some questions: 我有一些疑问:

1) Can the transformation matrix (from M = cv2.getPerspectiveTransform(...) ) be corrected for the pitch and roll angles? 1)可以针对俯仰角和侧倾角校正转换矩阵(来自M = cv2.getPerspectiveTransform(...))吗?

2) Should I just transform the source points and get a new transformation matrix? 2)我是否应该仅变换源点并获得新的变换矩阵? Roll seems like a simple enough correction since it's analogous to rotating the image, but how can I get the proper transformation for both roll and pitch? 横摇看起来很简单,因为它类似于旋转图像,但是如何获得横摇和俯仰的正确变换呢?

If the camera motion is approximately a rotation about its optical center / lens entrance pupil (for example, pan-tilt-roll on a tripod with the subject distance much larger than the translation of the optical center), then images taken from rotated viewpoints are related by a homography. 如果摄像机的运动大约是围绕其光学中心/镜头入射光瞳的旋转(例如,三脚架上的云台旋转,其被摄体距离远大于光学中心的平移),则从旋转的视点拍摄的图像就是单应相关。

If you know the 3D rotation (pan/tilt/roll), then you can explicitly compute the homography and apply it to the image. 如果您知道3D旋转(平移/倾斜/滚动),则可以显式计算单应性并将其应用于图像。 If not, but you have two images upon which you can identify 4 corresponding points or more, then you can estimate the homography directly from those correspondences. 如果不是,但是您有两个图像可以在其上标识4个或更多对应点,则可以直接从这些对应关系估计单应性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM