# Matlab axis position camera

9 views (last 30 days)
Umberto Fontana on 20 Jul 2017
Answered: Will Nitsch on 27 Jul 2017
Hi, I have a problem in axis position in perspective vision of the camera. I don't understand where it place the axis origin. Could someone help me? Thank you
##### 2 CommentsShowHide 1 older comment
Umberto Fontana on 20 Jul 2017
thank you for your answer. I will try to explain better. I want to simulate a camera which points to the center of a grid of known measures, so i specify the camera features. This is the code:
% code
pos_cam_z = 4450;
fig = figure;
imshow(imIn);
[altezza,larghezza] = size(im);
axis on;
ax=gca;
ax.Units = 'pixel';
ax.Projection = 'perspective';
ax.CameraViewAngle = Vfov;
ax.CameraUpVector = [0 -1 0]';
ax.DataAspectRatio = [1 1 1];
ax.CameraTarget = [larghezza/2 altezza/2 0];
ax.CameraPosition = [(larghezza/2) altezza/2 pos_cam_z];
My problem is that the representation of the scene is not centered. I want to ceneter it by acting on axis position, but i don't understand where matlab places axis origin.

Will Nitsch on 27 Jul 2017
You can find some useful diagrams/information on camera properties here: https://www.mathworks.com/help/matlab/visualize/low-level-camera-properties.html
The origin in MATLAB is at 0,0,0. So if you want to calculate new camera positions for something like rotating around the center of your data, your math that does so should include an offset for x, y and z that account for the position of the center of the data. This point is also the camera target.