0

我正在使用此代码模拟真实相机来捕捉 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

4

0 回答 0