如何将矩形装配到具有尺寸和形状的空间中(获取相对的相机位置)? [英] How to fit a rectangle into a space (get relative camera position) having its dimentions and shape?

查看:102
本文介绍了如何将矩形装配到具有尺寸和形状的空间中(获取相对的相机位置)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我们有一条道路的网络摄像头图像。我们选择了4条相连的2d矩形线,我们知道它们之间存在90度角。我们已经设定了他们的现实生活维度。如何从此类数据获取相对于该矩形的3d摄像机位置?

Say we have a web cam image of a road. We have picked 4 connected 2d lines of a rectangle, and we know there are 90deg angles between them. We have set their real life dimentions. How one can get 3d camera position relative to that rectangle from such data?

推荐答案

具有4对相应的坐标-实词对和相机矩阵处的坐标(在照片图像坐标系中),例如,可以计算透视变换矩阵,具有OpenCV函数 getPerspectiveTransform

Having 4 pairs of corresponding coordinates - real word ones and coordinates at camera matrix (in photo image coordinate system), one can calcalate matrix of perspective transformation, for example, with OpenCV function getPerspectiveTransform.

然后应用 decomposeProjectionMatrix

如果您使用其他方式/库进行图像采集/处理,则它们可能包含一些模拟内容以色列

If you are using another means/libraries for image acquisition/treatment, they might contain something similar

这篇关于如何将矩形装配到具有尺寸和形状的空间中(获取相对的相机位置)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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