Camera looking down the negative Z-Axis

조회 수: 11 (최근 30일)
Alex Ruiz
Alex Ruiz 2019년 11월 3일
답변: George Abrahams 2024년 2월 10일
Hello,
I have been trying to use the PlotCamera code to plot a camera using the world coordinate system but it currently only plots in the camera coordinate system.
I essentially want to produce this:
The Camera is looking down the negative Z Direction.
It is commonly used in game developement and in languages like openGL.
I have tried for a long time but I think there is just a limitation in the code since when you pass it the proper inputs it turns out errors.
Please let me know,
Thank you.

답변 (2개)

Qu Cao
Qu Cao 2019년 11월 7일
편집: Qu Cao 2019년 11월 7일
Hi Alex,
In Computer Vision Toolbox we use the y-down/z-forward camera coordinate systems:
You can convert your coordinates [x1, y1, z1] to the one used in CVT [x2, y2, z2] as follows:
x2 = x1;
y2 =-y1;
z2 =-z1;
Thanks,
Qu
  댓글 수: 1
Alex Ruiz
Alex Ruiz 2019년 11월 8일
Hello, I appreciate the responce!
Im using this for a robust application using multiple cameras in different quadrants. Adding the negative sign to the code isnt the best practice, since this code is the ground truth for another project. I am relaying on camera matrix/oriention matrix/translation vectors for position and rendering.
is there any other way?
I have found this to be a huge road block for my research field.

댓글을 달려면 로그인하십시오.


George Abrahams
George Abrahams 2024년 2월 10일
Hi @Alex Ruiz. This is equivalent to an 180 degree rotation around the camera's local X-axis. The position of the camera won't be affected.
If you're using quaternions to store the rotations, you can do it like this. Note that in this example, randrot is from the Navigation Toolbox, while the quaternion class is available in multiple different toolboxes.
% Generate 10 random quaternion rotations, as sample data.
cameraRotations = quaternion( randrot( 10, 1 ) )
% This quaternion represents an 180 degree rotation around the X-axis.
basisRotation = quaternion( [0 1 0 0] );
% Perform the rotation in each camera's local coordinate system.
cameraRotations = cameraRotations * basisRotation

카테고리

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