如何找到增强现实的相机矩阵? [英] How to find Camera matrix for Augmented Reality?

查看:31
本文介绍了如何找到增强现实的相机矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 x,y,z 米 wrt 相机上增强一个虚拟对象.OpenCV 具有相机校准功能,但我不明白我究竟能以米为单位给出坐标

I want to augment a virtual object at x,y,z meters wrt camera. OpenCV has camera calibration functions but I don't understand how exactly I can give coordinates in meters

我尝试在 Unity 中模拟相机,但没有得到预期的结果.

I tried simulating a Camera in Unity but don't get expected result.

我如下设置投影矩阵,并在 z = 2.415 + 0.5 处创建一个单位立方体.其中 2.415 是眼睛和投影平面之间的距离(针孔相机模型)既然立方体的面在前剪裁平面并且它的尺寸是单位,它不应该覆盖整个视口吗?

I set the projection matrix as follows and create a unit cube at z = 2.415 + 0.5 . Where 2.415 is the distance between the eye and the projection plane (Pinhole camera model) Since the cube's face is at the front clipping plane and it's dimension are unit shouldn't it cover the whole viewport?

    Matrix4x4 m = new Matrix4x4();
    m[0, 0] = 1;
    m[0, 1] = 0;
    m[0, 2] = 0;
    m[0, 3] = 0;

    m[1, 0] = 0;
    m[1, 1] = 1;
    m[1, 2] = 0;
    m[1, 3] = 0;

m[2, 0] = 0;
    m[2, 1] = 0;
    m[2, 2] = -0.01f;
    m[2, 3] = 0;

    m[3, 0] = 0;
    m[3, 1] = 0;
    m[3, 2] = -2.415f;
    m[3, 3] = 0;

推荐答案

我最终手动测量了视野.一旦您知道 FOV,您就可以轻松创建投影矩阵.无需担心单位,因为最终投影的形式为 ( X*d/Z, Y*d/Z ).无论 X、Y、Z 的单位是什么,X/Z 的比率都保持不变.

I ended up measuring the field of view manually. Once you know FOV you can easily create the projection matrix. No need to worry about units because in the end the projection is of the form ( X*d/Z, Y*d/Z ). Whatever the units of X,Y,Z may be the ratio of X/Z remains the same.

这篇关于如何找到增强现实的相机矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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