# Knowledge Base: Registration export and camera orientations

**URL:** <https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588>\
**Category:** Getting Started & Setup\
**Tags:** realityscan\
**Created:** [November 2, 2022, 2:47pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588 "2022-11-02T14:47:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rudy.Triplett](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rudy.Triplett](https://forums.unrealengine.com/u/Rudy.Triplett)\
**Post date:** [November 2, 2022, 2:47pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/1 "2022-11-02T14:47:47Z")

</div>

Registration export and camera orientations  
In RealityCapture we define camera orientations this way:

Yaw - prior rotation angle Yaw (around Z axis)  
Pitch - prior rotation angle Pitch (around Y axis)  
Roll - prior rotat…  
  
[https://dev.epicgames.com/community/learning/knowledge-base/7yvm/realityscan-registration-export-and-camera-orientations](https://dev.epicgames.com/community/learning/knowledge-base/7yvm/realityscan-registration-export-and-camera-orientations)

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua\_R](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mr_joshua_r/32/737530_2.png) [@Mr\_Joshua\_R](https://forums.unrealengine.com/u/Mr_Joshua_R)\
**Post date:** [August 1, 2023, 1:46pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/2 "2023-08-01T13:46:52Z")

</div>

Been trying to get my head around this for a while so may as well just ask:

How do I export camera locations from RC which uses Z-up so that camera locations are in Y up orientation (Y up, X Right, Z Forward)?

I just need what is shown here:

(#) Cameras  
(#) PhotoID, X, Y, Z, Omega, Phi, Kappa

No matter what I try the imported positions are wrong, any help greatly appreciated

---

<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:** [August 1, 2023, 2:05pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/3 "2023-08-01T14:05:59Z")

</div>

Hi [MrJR](https://forums.unrealengine.com/u/MrJR),  
to do so you will need to change the calibration.xml file. The file can be found in C:\Program Files\Capturing Reality\RealityCapture.  
There you can find the wanted option or create your own which will have replaced Y and Z values.  
Like:

```auto
<format id="{B3EE1544-1D64-4C22-A47D-FC9F78C107B7}" mask="*.csv" descID="8367" desc="Comma separated, Name, X, Z, Y, Omega, Phi, Kappa" writer="cvs" requires="component">
        <body EulerFormat="xyz">#cameras $(cameraCount)
#name,x,z,y,omega,phi,kappa
$ExportCameras($(imageName)$(imageExt),$(x),$(z),$(y),$(omega),$(phi),$(kappa)
)</body>
    </format>

```

But there could be also issues with omega, phi, kappa, probably those values will be needed to be changed accordingly. Also, there could be bug for exported OPK values.

Where are you trying to import camera positions?

---

<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:** [August 1, 2023, 2:40pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/5 "2023-08-01T14:40:14Z")

</div>

To do so you can export Registration as Internal/External camera parameters  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/7/73719d439a38067940fdb91162dbbb837ab5a302.png)  
and there you can set the rotations:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/c/d0cc55f7051123b2893ef7400f3f856210364912.png)

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua\_R](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mr_joshua_r/32/737530_2.png) [@Mr\_Joshua\_R](https://forums.unrealengine.com/u/Mr_Joshua_R)\
**Post date:** [August 2, 2023, 9:17am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/6 "2023-08-02T09:17:44Z")

</div>

The main problem however is the X,Y,Z values bring in the cameras at the correct locations but the omega,phi, kappa are the wrong rotations

---

<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 19, 2023, 10:45am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/7 "2023-10-19T10:45:05Z")

</div>

were you able to solve this problem? I am also facing it

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua\_R](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mr_joshua_r/32/737530_2.png) [@Mr\_Joshua\_R](https://forums.unrealengine.com/u/Mr_Joshua_R)\
**Post date:** [October 19, 2023, 11:00am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/8 "2023-10-19T11:00:11Z")

</div>

I’ve not been able to get this to work, the Omega Phi Kappa just seem broken and thus have given up for now

---

<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 19, 2023, 11:52am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/9 "2023-10-19T11:52:39Z")

</div>

hey, can you help us here maybe?

I have the same problem, I try to import the cameras and a mesh in open3d (python). The mesh and the cameras positions work fine, but I can’t get the camera orientation right.

---

<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 19, 2023, 1:24pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/10 "2023-10-19T13:24:57Z")

</div>

Hi [Thomas\_Gorski](https://forums.unrealengine.com/u/Thomas_Gorski),  
I see you also created a ticket regarding this issue. It will be answered.  
Also, which option are you exporting?

---

<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 19, 2023, 1:51pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/12 "2023-10-19T13:51:30Z")

</div>

Thank you. We export a camera registration csv file with these settings

```auto
<Configuration id="{2D5793BC-A65D-4318-A1B9-A05044608385}">
  <entry key="calexTrans" value="1"/>
  <entry key="calexHasDisabled" value="0x0"/>
  <entry key="MvsExportScaleZ" value="1.0"/>
  <entry key="MvsExportIsGeoreferenced" value="0x1"/>
  <entry key="MvsExportIsModelCoordinates" value="0"/>
  <entry key="MvsExportScaleY" value="1.0"/>
  <entry key="MvsExportScaleX" value="1.0"/>
  <entry key="MvsExportRotationY" value="0.0"/>
  <entry key="MvsExportcoordinatesystemtype" value="0"/>
  <entry key="MvsExportNormalFlipZ" value="false"/>
  <entry key="MvsExportRotationX" value="-90.0"/>
  <entry key="hasCalexFilePath" value="1"/>
  <entry key="MvsExportNormalFlipY" value="false"/>
  <entry key="MvsExportNormalSpace" value="Mikktspace"/>
  <entry key="calexHasUndistort" value="-1"/>
  <entry key="MvsExportNormalFlipX" value="false"/>
  <entry key="MvsExportRotationZ" value="0.0"/>
  <entry key="calexFileFormat" value="Internal/External camera parameters"/>
  <entry key="MvsExportMoveZ" value="0.0"/>
  <entry key="calexFileFormatId" value="{0CA18733-1EBC-4254-9974-17197EB409BD}"/>
  <entry key="hasCalexFileName" value="1"/>
  <entry key="calexHasImageExport" value="-1"/>
  <entry key="MvsExportMoveX" value="0.0"/>
  <entry key="MvsExportNormalRange" value="ZeroToOne"/>
  <entry key="MvsExportMoveY" value="0.0"/>
</Configuration>

```

Then we import it into open3d which is y-up coordinate system

---

<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 19, 2023, 3:28pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/13 "2023-10-19T15:28:43Z")

</div>

Have you tried this (change the Y and Z coordinates) and not rotate the model:

> [@OndrejTrhan](#):
>
> ```auto
> <format id="{B3EE1544-1D64-4C22-A47D-FC9F78C107B7}" mask="*.csv" descID="8367" desc="Comma separated, Name, X, Z, Y, Omega, Phi, Kappa" writer="cvs" requires="component">
> <body EulerFormat="xyz">#cameras $(cameraCount)
> #name,x,z,y,omega,phi,kappa
> $ExportCameras($(imageName)$(imageExt),$(x),$(z),$(y),$(omega),$(phi),$(kappa)
> )</body>
> </format>
> 
> ```

And also set the YPR values according to that.  
When rotating a point cloud/model in the export, it is not being rotated around the “global” system, but around the model’s center, which could cause some orientation issues.  
Also, in RC Yaw is around Z, Pitch around Y and Roll around X

---

<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:53pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/14 "2023-10-21T12:53:27Z")

</div>

I tried that and the same problem occurs. I honetly don’t understand how I come from the yaw, pitch and roll to the camera direction vector in the world system. This should not be so complex.

---

<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 23, 2023, 8:21am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/15 "2023-10-23T08:21:43Z")

</div>

What would be the correct rotation matrix to calculate the camera direction vector from the ypr values? and what is the default camera direction?

---

<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 23, 2023, 8:24am UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/16 "2023-10-23T08:24:53Z")

</div>

Default camera position:

 ![|371px;x263px;](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/4/9/549053acb91ba6a59229810faff2e0fbed22461e.png)  
(showd is RC’s coordinate system)  
Yaw = 0, image is oriented to Y (upper side of image is oriented that way)  
Pitch = 0, image is looking down  
Roll = 0, image is parallel with X axis

Rotation matrix computation:  
inline void FromYPR( \_\_in\_ecount( 3 ) double \*pYpr, \_\_out\_ecount( 9 ) double \*pR, \_\_in UINT eulerSignature = 5 )  
{  
// camera-plane offset  
// plane cs: X-north, Y-right, Z-down  
// camera is mounted looking down: X-right, Y-plane tail, Z-down  
double T[9];  
T[0] = 0; T[1] = -1; T[2] = 0;  
T[3] = 1; T[4] = 0; T[5] = 0;  
T[6] = 0; T[7] = 0; T[8] = 1;

```
_ASSERT( Mat33Det( T ) > 0 );

double R[9];
double intAngles[3];
intAngles[0] = pYpr[2];
intAngles[1] = pYpr[1];
intAngles[2] = pYpr[0];
MatrixEulerCompose( eulerSignature, intAngles, R );
Mat33Mul( R, T );

// our CS is X-east, Y-north, Z-up
T[0] = 0;	T[1] = 1;	T[2] = 0;
T[3] = 1;	T[4] = 0;	T[5] = 0;
T[6] = 0;	T[7] = 0;	T[8] = -1;
_ASSERT( Mat33Det( T ) > 0 );

Mat33Mul( T, R, pR );

// convert from object rotation to camera rotation (inverse)
Mat33Transpose( pR );
_ASSERT( Mat33Det( pR ) > 0 );

```

}

In javascript:

```
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];
},

```

---

<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 23, 2023, 2:21pm UTC](https://forums.unrealengine.com/t/knowledge-base-registration-export-and-camera-orientations/682588/17 "2023-10-23T14:21:22Z")

</div>

thank you, that helped me!
