Forum

Author Topic: how to get camera positions and rotations in world co-ordinates?  (Read 10683 times)

peter_shilton

  • Newbie
  • *
  • Posts: 3
    • View Profile
how to get camera positions and rotations in world co-ordinates?
« on: November 16, 2011, 12:15:31 AM »
To calculate the camera position and rotation
I try using the "Export points" in Photoscan structure .xml format, what is the structure of this file.
It seems to have a transform tag with 16 values.
Is this a 4x4 matrix?
Would it be possible for me to get the positions and rotation of camera in world co-ordinates.

Would it be easier to get this in .xml format or the .chan format.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: how to get camera positions and rotations in world co-ordinates?
« Reply #1 on: November 16, 2011, 01:01:34 PM »
Hello Peter,

Yes it is 4x4 matrix in .xml file  that is a result of a multiplication of Rotation, Translation and Scale matrices.

To get camera positions in world or local coordinates you can for example export cameras (using Export Points command) to Omega-Phi-Kappa format. It also contains information about rotation matrix.
Best regards,
Alexey Pasumansky,
Agisoft LLC

peter_shilton

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: how to get camera positions and rotations in world co-ordinates?
« Reply #2 on: November 16, 2011, 04:59:10 PM »
Hello Alexey,
The OPK format contains the following info per camera

X, Y, Z, Omega, Phi, Kappa, r11, r12, r13, r21, r22, r23, r31, r32, r33

1. are the XYZ the actual postions of camera in world co-ordinates?

2. You see I'm not so good at the math. So to get the rotation of the camera how do I use the 3 x 3 rotation matrix ?
Could you let me know the equation or the math behind it?

3. In the Photoscan XML file is the transform tag 4 x 4 matrix in row major or column major?
is it stored like
r11 r12 r13 r14 r21 r22 r23 r24 r31 r32 r33 r34 r41 r42 r43 r44

With Regards,
Peter
« Last Edit: November 17, 2011, 01:54:21 PM by peter_shilton »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: how to get camera positions and rotations in world co-ordinates?
« Reply #3 on: November 18, 2011, 04:51:36 PM »
Hello Peter,

1) Yes, these coordinates are world coordinates if the model is georeferenced.

2) This matrix is camera rotation matrix. Using it you can transform vector from camera coordinate system into world's coordinates. M x Vc = Vw (M - camera rotation matrix, Vc - vector in camera's coordinates, Vw - vector in world's coordinates).

3) 4x4 matrix in PhotoScan XML is row-major just as you've written.
Best regards,
Alexey Pasumansky,
Agisoft LLC

peter_shilton

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: how to get camera positions and rotations in world co-ordinates?
« Reply #4 on: November 22, 2011, 08:50:47 AM »
Hello Alexey,

How would I know the world origin. I believe the matrix 4 x 4 in the photoscan xml file contains Rotation 3x3 and translation 1x3 right?
Is this translation vector actually the world centre expressed in the camera co-ordinate system?