matlab - 相机视角(垂直和水平)
问题描述
我正在使用此代码模拟真实相机来捕捉 3D 对象:
patch(ax, Object3D, 'FaceColor', 'flat');
camva(ax, rad2deg(VerticalAOV)); % Set the camera field of view
camup(ax, [0 -1 0]);
campos(ax, [CameraPosition.X CameraPosition.Y CameraPosition.Z]); % Put the camera at the origin
camtarget(ax, [CameraPosition.X CameraPosition.Y CameraPosition.Z] + [0 0 1]); % The camera looks along the +Z axis
camproj(ax,'perspective');
axis image;
axis off;
WidthResolution = SensorWidthResolution/(ax.Position(3));
Image = export_fig('temp.jpg',ax, sprintf('-r%f', WidthResolution),'-nocrop');
[ImageHeight, ImageWidth, Channels] = size(Image);
Image = imcrop(Image,[(ImageWidth-Width)/2, (ImageHeight-Height)/2, Width-1, Height-1]);
问题是:
我使用 VerticalAOV 作为 camva 的输入。我根据这张图片选择了 VerticalAOV。然而,这是不合逻辑的。要获得真实的视图,应该同时提供水平和垂直角度。
[ImageHeight, ImageWidth, 通道] = size(Image); 返回错误的值。ImageWidth 和 ImageHeight 没有提供正确的值。很明显,其中一个维度会出错,因为只提供了 AOV 的一个维度。但是,为什么两者都不正确?
我做的裁剪是为了校正图像的尺寸。但是,这似乎不是有用的步骤(我使用我拥有的地面实况数据检查了结果,但它们不匹配)。
PS export_fig 可以在这里找到:https ://github.com/altmany/export_fig
解决方案
推荐阅读
- amazon-web-services - 如何在 Route53 中将多个区域 Load-Balancers Alias 记录设置为单个名称?
- php - PHP在迭代剧集作者对象时将唯一的用户数组添加到新创建的数组
- python - 饼图未在烧瓶应用程序中正确呈现
- node.js - findall include 里面 include by use Sequelize
- sql-server - SQL Server 代理找不到备份作业的证书
- cypress - 赛普拉斯测试 - 用于 URL 匹配
- c++ - 多个类的通用调度程序
- javascript - 如何使用 get 方法从 response.data 中提取道具
- facebook - 无法使用 Facebook Graph API 阻止用户访问页面
- r - 使用 Shiny 在 R 中绘制股票波动率