Forum

Author Topic: Camera exterior orientation in ECEF (for use with Ames Stereo Pipeline)  (Read 2098 times)

adehecq

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hello,

I would like to export the cameras aligned within Metashape into a different reference system for use with an exteranl software (NASA Ames Stereo Pipeline). The software works only in geocentric ECEF coordinates. I would need to extract each camera center and rotation matrix into this coordinate system. I f I'm correct, the following lines of code will convert the camera center into ECEF?

   camera = chunk.cameras[0]
   T = chunk.transform.matrix
   cen_p = camera.center
   cen_t = T.mulp(cen_p)

However, I'm not sure how to export the rotation matrix in the ECEF system. Could you please help me with that?
Thank you.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14816
    • View Profile
Best regards,
Alexey Pasumansky,
Agisoft LLC

adehecq

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hi Alexey,

Thanks for the link. I saw that before and tried it. Unfortunately, it's returns me the same yaw/pitch/roll that I provided in, which is the rotation between the camera frame and local tangent plan.
In my test case, my camera is looking north, parallel to the ground, so YPR is about 0, 90, 0. But the rotation between the camera frame and the ECEF frame should be very different than that.

The link you said states : "how to calculate the exterior orientation parameters [...] in the georeferenced chunk". I tried setting the chunk CRS to EPSG 4978 (geocentric) to see if it makes a difference, but it doesn't. The returned R matrix is the same.
In the following line "R = (m * T * camera.transform * Metashape.Matrix().Diag([1, -1, -1, 1])).rotation()"
What is the meaning of m and the diagonal matrix ( 1,-1,-1, 1)?
If I remove m from this equation, wouldn't it give me the rotation matrix to ECEF?
Thanks,

Paulo

  • Hero Member
  • *****
  • Posts: 1303
    • View Profile
Hi adehecq,

yes removing the m from (m * T * camera.transform * Metashape.Matrix().Diag([1, -1, -1, 1])).rotation() would give you the rotation from camera coordinate system to geocentric coordinate system as m goes from geocentric coordinates to local plane tangent coordinates....

So rotation matrix in geocentric coordinate system would be (T * camera.transform * Metashape.Matrix().Diag([1, -1, -1, 1])).rotation()
« Last Edit: April 16, 2020, 07:50:31 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor