Camera view angle (Vertical and Horizontal)

조회 수: 2 (최근 30일)
Humam Helfawi
Humam Helfawi 2019년 3월 2일
Hi,
I am using this code simulate real camera to capture 3D object:
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]);
The problems are:
  • I used VerticalAOV as input for camva. I chose VerticalAOV based on this image. However, this is illogical. To get real view, one should provide both Horizontal and Vertical Angle.
  • [ImageHeight, ImageWidth, Channels] = size(Image); returns wrong values. ImageWidth and ImageHeight does not provide the correct values. It is clear that one of the dimessions would wrong since only one dimenssion of the AOV was provided. However, why both of them are not correct?
  • The crop I made is to correct the dimenssions of the image. However, it seems to be not usefull step (I checked the result using ground truth data I have and they did not match).
Thanks in advance!

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by