# Camera Coordinate System Explanation

**URL:** <https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595>\
**Category:** Asset Creation\
**Tags:** realityscan\
**Created:** [June 29, 2022, 2:51pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595 "2022-06-29T14:51:13Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 29, 2022, 2:51pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/1 "2022-06-29T14:51:13Z")

</div>

Hello,

My question is similar to [this](https://forums.unrealengine.com/hc/en-us/community/posts/4814175050652-Please-help-us-understand-the-Internal-External-Camera-Parameters-export) 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. &nbsp;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?&nbsp;
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 !

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [June 30, 2022, 10:01am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/2 "2022-06-30T10:01:50Z")

</div>

Hi [AleN77S](https://forums.unrealengine.com/hc/en-us/profiles/5215708725788-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.&nbsp;

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](https://forums.unrealengine.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:

&nbsp;

---

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 30, 2022, 10:22am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/3 "2022-06-30T10:22:34Z")

</div>

@[Ondrej Trhan CR](https://forums.unrealengine.com/hc/en-us/profiles/374823146340-Ondrej-Trhan-CR)&nbsp;Thank you so much for your quick reply !

So to clarify about question 3.&nbsp;

We are talking about 3 coordinate systems (for **rotation** ).&nbsp;

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 ?

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [June 30, 2022, 11:29am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/4 "2022-06-30T11:29:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 30, 2022, 11:33am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/5 "2022-06-30T11:33:58Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [June 30, 2022, 11:54am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/6 "2022-06-30T11:54:13Z")

</div>

Yes, camera coordinate system:

and Z down, into screen

---

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 30, 2022, 12:01pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/7 "2022-06-30T12:01:54Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 30, 2022, 12:08pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/8 "2022-06-30T12:08:49Z")

</div>

Hello,

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

> EulerRotation: function (y, p, r) {
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var cx = Math.cos(LA.Deg2Rad \* r);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var cy = Math.cos(LA.Deg2Rad \* p);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var cz = Math.cos(LA.Deg2Rad \* y);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var sx = Math.sin(LA.Deg2Rad \* r);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var sy = Math.sin(LA.Deg2Rad \* p);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var sz = Math.sin(LA.Deg2Rad \* y);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return [cx \* cz + sx \* sy \* sz, -cx \* sz + cz \* sx \* sy, -cy \* sx,
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -cy \* sz, -cy \* cz, -sy,
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cx \* sy \* sz - cz \* sx, cx \* cz \* sy + sx \* sz, -cx \* cy];
> 
> &nbsp;&nbsp;&nbsp; }

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) ?

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [June 30, 2022, 12:20pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/9 "2022-06-30T12:20:18Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Anonymous\_35e7fba835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_35e7fba835](https://forums.unrealengine.com/u/Anonymous_35e7fba835)\
**Post date:** [June 30, 2022, 12:28pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/10 "2022-06-30T12:28:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NJFerrier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NJFerrier](https://forums.unrealengine.com/u/NJFerrier)\
**Post date:** [October 4, 2023, 7:01pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/11 "2023-10-04T19:01:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [October 5, 2023, 7:26am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/12 "2023-10-05T07:26:49Z")

</div>

Hi [NJFerrier](https://forums.unrealengine.com/u/NJFerrier),  
it is quite long time ago, but I think first image was the coordinate system setting in Export transformation settings  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/1/c7125e88411e0b2ce655c72d18ff09f5c54d81a0.png)

RC CS orientation:  
 **![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/d/f4dd7348271917bced9e32f20728cdf87b611385.png)**

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.

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/0/c203bf2ab5ff8def4d2bf1dd3aa73d08135cb010.png)

Coordinate system for YPR definition:  
 ![CS_YPR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/d/57ddb5d56c7c0c92287e186d55ef9f6c21ec5c8e.png)  
X to north, Y to east, Z down

---

<div class="post-metadata">

**Author:** ![NJFerrier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NJFerrier](https://forums.unrealengine.com/u/NJFerrier)\
**Post date:** [October 6, 2023, 7:22pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/13 "2023-10-06T19:22:58Z")

</div>

> [@OndrejTrhan](#):
>
> YPR

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.

---

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [October 9, 2023, 7:38am UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/14 "2023-10-09T07:38:16Z")

</div>

Hi, the whole process should be explained here: [RealityCapture XMP Camera Math](https://forums.unrealengine.com/t/realitycapture-xmp-camera-math/682564)

---

<div class="post-metadata">

**Author:** ![Dani\_rm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dani\_rm](https://forums.unrealengine.com/u/Dani_rm)\
**Post date:** [October 21, 2023, 12:51pm UTC](https://forums.unrealengine.com/t/camera-coordinate-system-explanation/712595/15 "2023-10-21T12:51:15Z")

</div>

Did you manage to import the camera orientations into open3d?
