Camera view angle (Vertical and Horizontal)

7 views (last 30 days)
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!

Answers (0)

Categories

Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!