Matlab axis position camera

4 views (last 30 days)
Umberto Fontana
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 Comments
Jan
Jan on 20 Jul 2017
What is your question? Please post some code which demonstrates your problem? Otherwise it would be required to rephrase the complete documentation of camorbit, zoom, axes, axis, camdolly, campan, camroll, camzoom, etc. Better spend the time to explain your specific problem.
Umberto Fontana
Umberto Fontana on 20 Jul 2017
Edited: 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.

Sign in to comment.

Answers (1)

Will Nitsch
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.

Community Treasure Hunt

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

Start Hunting!