# Roll pitch roll to Pix4d rotation matrix

In my TIFF images i have the following initial metadata: XMP::Roll   XMP::Pitch   XML::Yaw.

I need to convert those params to a rotation-matrix R.

I would like to compare metadata initial R with the Pix4D optimized one (i.e. the one stored in the calibrated_camera_parameters.txt file).

Any tip about how to do it?

Hi Giorgio,

You will find the necessary information in the paper, but more details about the math involved especially in the companion notes. Since what you want to do is compare the results with what Pix4D computes, you will have to do the conversion manually.

Let us know how the comparison went!

Hi Rhea,

I was trying to compute the Omega, phi and Kappa values from the formulas given in the above documents.

I took the rotation matrix from calibrated_camera_parameters.txt file inside the Pix4D’s output params folder. As given in companion notes, I multiplied the matrix with [(-1,0,0),(0,1,0),(0,0,-1)]. Then I followed the formulas given in right column of table1 in page 6.

omega = arctan −C 2,3/C 3,3

phi = arctan C 1,3/sqrt(C 2,3 **2 + C 3,3 **2)

kappa = arctan −C 1,2/C 1,1

And I compared the values with those given in calibrated_external_camera_parameters.txt file in same params folder.

I found that for some images the Kappa angle came same, but for others, Pix4D has done +/- 180 to the absolute value. I am interested in knowing the logic/pattern about how Pix4D identifies such images?

Thank you.

Hi,
It could be that you did not consider good quadrants when doing the DCM transformation. At least in Matlab, you should use atan2 instead of atan in order to pick the right quadrant.