Camera Coordinate System Explanation

Hello,

My question is similar to this post.

Given the camera output .csv file:

#name,x,y,alt,heading,pitch,roll,f,px,py,k1,k2,k3,k4,t1,t2
DJI_20220221103904_0022.JPG,-5041986.508798251,2573482.020935406,-2929105.142556032,-148.4200306549068,10.20497551291449,118.7049066788339,34.98005589922394,2.08370424314095e-003,8.261463622613804e-003,-4.472883919490048e-002,4.299250744468713e-002,-0.1293881883164149,0,0,0 DJI_20220221103956_0044.JPG,-5041974.610274723,2573499.802754866,-2929110.290966901,10.38505537635033,-9.7283810446774,-115.7011765380064,35.00697049557222,-2.759873217514973e-003,1.409853041227379e-002,-4.302171265375437e-002,2.572761946144416e-002,-9.709280172749243e-002,0,0,0

My questions are:

  1.  Are x, y, alt in world coordinate system ? or camera coordinate system?
  2. Is alt just “z” ?
  3. Is the “heading,pitch,roll” rotation in the world coordinate system ? or camera coordinate system? 
  4. Is “f” in pixels ?
  5. Is “px/py” in pixels too ?

As as I understood from the previous post, “heading,pitch,roll” is in a local camera coordinate system ?

Can you please draw the camera coordinate system and the world coordinate system ?

Thanks a lot !

 

 

 

 

Hi AleN77S,

I will try to answer your questions.

  1. These coordinates depend on what you have set in the application, when you export these parameters:

Also, you need to have set the Output coordinate system in the application settings

  1. Yes, alt (altitude) is for Z.

  2. It depends on your coordinate system settings, it is related with camera coordinate system, as the Z axis is pointing down, X to the north and Y to east. Then Yaw is rotation around Z axis, Pitch around Y axis and Roll around X. But in RealityCapture are these axis defined differently (like on next image):
    so it could be a little bit confusing. On the image is all set to 0. 

  3. f in in mm regards to 35 mm format. More about this you can find here: https://support.capturingreality.com/hc/en-us/articles/360017783459-RealityCapture-XMP-Camera-Math

  4. px and py is also regards to 35 mm format (basically it a value from RC divided by 36)

Coordinate system of RC:

Camera coordinate system:

Coordinate system for YPR definition:

 

@Ondrej Trhan CR Thank you so much for your quick reply !

So to clarify about question 3. 

We are talking about 3 coordinate systems (for rotation ). 

  1. Camera Coordinate system of Reality Capture which is, y (down), z (north), x (east) as in your picture.
  2. The Coordinate system that YPR are defined for, which is, z (down), x (north), y (east) as in your last picture.
  3. Finally the world coordinate system of RC, which is, z (up), x (east), y (north)

So assume this scenario:

I want to take a camera from the .csv file and render it in my own coordinate system (in Open3D Python).

The translation should be OK (I can use the same) because Open3D Python and Reality Capture have the same WORLD coordinate system.

Now for the rotation , I have to follow this steps:

  1. Transform from Coordinate system for YPR (2) to Reality Capture Camera Coordinate system (1).
  2. Then transform from Reality Capture Camera Coordinate system (1) to Coordinate system of RC (3).

Is my logic correct ?

Hi, the camera X is to east, Y to south and Z down.

I think you can also use the exported rotations, the vales are generally created like from each photogrammetry software.

Sorry I didn’t understand this,

the camera X is to east, Y to south and Z down.

Are you talking about the camera coordinate system? Isn’t that like in your picture y (down), z (north), x (east)?

Yes, camera coordinate system:

and Z down, into screen

Ok thanks, “down” is aiming in the screen not “south”

Thanks a lot! If I have any more questions I will add them here so it is all in one place, if people have the same question!

Hello,

One more question the code you shared in the previous post:

EulerRotation: function (y, p, r) {

        var cx = Math.cos(LA.Deg2Rad * r);

        var cy = Math.cos(LA.Deg2Rad * p);

        var cz = Math.cos(LA.Deg2Rad * y);

        var sx = Math.sin(LA.Deg2Rad * r);

        var sy = Math.sin(LA.Deg2Rad * p);

        var sz = Math.sin(LA.Deg2Rad * y);

        return [cx * cz + sx * sy * sz, -cx * sz + cz * sx * sy, -cy * sx,

        -cy * sz, -cy * cz, -sy,

        cx * sy * sz - cz * sx, cx * cz * sy + sx * sz, -cx * cy];

    }

This will return the rotation matrix from the euler angles in the Coordinate system for YPR definition, which is in your picture: z (south), x (down -into the screen), y (east) ?

This will return the rotation matrix based on the computed YPR angles. But there are the axis also defined differently, according to that picture, X is pointing to north, Y to east and Z down (like to the ground)

But there are the axis also defined differently, according to that picture, X is pointing to north, Y to east and Z down (like to the ground)

That is the YPR coordinate system, as in your last picture from the first post. So the rotation matrix is defined for that.

The images (showing the coordinate frames) all appear to be broken. Is there any way to have these images re-created?

Hi NJFerrier,
it is quite long time ago, but I think first image was the coordinate system setting in Export transformation settings
image

RC CS orientation:

Camera coordinate system
Camera CS is the system that has its origin on the image plane and the Z-axis is perpendicular to the image plane. The Z axis is in this case an optic axis.

Image coordinate system
It is related to the image itself, the Z axis is pointing “down” and the axis should start in the center of the image.

Coordinate system for YPR definition:
CS_YPR
X to north, Y to east, Z down

Thanks. What I’m trying to understand is the relationship between the rotation matrix given in the XMP file (relates world/RC frame to camera frame) and the 3 angles. Decomposing a rotation matrix is not unique - the 3 angles in the extrinsics output should allow me to generate the rotation matrix (e.g. Rot[z, heading] Rot[y,pitch] Rot[x,roll]; or Rot[x,heading]…) but there are a lot of options for how these angles were generated. Rather than exhaustively try all ordering of angles and rotation axes, is this documented anywhere? Thanks.

Hi, the whole process should be explained here: RealityCapture XMP Camera Math

Did you manage to import the camera orientations into open3d?