I need to convert coordinates and rotations from left-handed coordinate system (used by Unity) to right-handed (used by camera calib. toolbox in MATLAB\Octave)
While converting point coordinates may be easy, I cannot say the same for rotations. I need rotations in form of 3x3 rotation matrices, not quaternions.
For each object I have
$ t_{left} = \begin{bmatrix} x \\ y \\ z \end{bmatrix} $ and $ R_{left} = \begin{bmatrix} r11 & r12 & r13 \\ r21 & r22 & r23 \\ r31 & r32 & r33 \end{bmatrix} $
defined in coordinate frame from the left image. Which transformation should I apply to get $ t_{right} $ and $ R_{right} $ in the right coordinate frame?


Finally I managed to solve this by saving all data in Euler angles in Unity and converting it to Matlab/Octave coordinate system.
$R_X = rotX(-a_x);$
$R_Y = rotY(-a_y);$
$R_Z = rotZ(-a_z);$
$R = R_Z*R_X*R_Y;$
$coords = [x; z; y];$
The code is here: https://gist.github.com/tushev/b5c162c059b5e1c0011809ae0e871015
You will need Camera Calibration Toolbox by Jean-Yves Bouguet to get it working.
Thanks to everyone for help!