Forum

Author Topic: Transformation matrix between pointcloud and camera  (Read 3649 times)

babotea

  • Newbie
  • *
  • Posts: 1
    • View Profile
Transformation matrix between pointcloud and camera
« on: April 25, 2019, 01:30:41 PM »
Hi All,

I'm currently using Agisoft Metashape Standard 1.5.2. I have created dense cloud using 6 cameras. I export points (XYZ) and camera in agisoft XML format.

Could anyone point me out how to determine the relationship between pointclouds and cameras?

In the camera export, I have a 4x4 matrix which should be its projection matrix transforming its local (world) coordinate system to the camera coordinate system.

      <camera id="150" sensor_id="3" label="Front">
        <transform>2.6820370473203603e-001 1.3446275402548258e-001 -9.5393214672108295e-001 -2.1636560095239896e+000 2.2031328011198015e-001 -9.7253059016345711e-001 -7.5141931054625438e-002 6.4176770852101956e+000 -9.3783198461894612e-001 -1.9001057595881468e-001 -2.9046023763931694e-001 -1.5814986849312186e+001 0 0 0 1</transform>
        .....
      </camera>

But at the end of the file, I also found another <transform> containing a single <rotation> and <translation>, which I don't quite understand.

    <transform>
      <rotation locked="false">9.9806616004513493e-001 -1.1181879989736994e-002 6.1146592158959429e-002 4.7912979822793356e-002 7.6508013335616765e-001 -6.4215008830351294e-001 -3.9601597660442994e-002 6.4383798824207616e-001 7.6413634801593910e-001</rotation>
      <translation locked="false">3.4907376798206847e+001 -1.2150597136175513e+001 3.0027245704839842e+000</translation>
    </transform>
    <reference>LOCAL_CS["Local Coordinates (m)",LOCAL_DATUM["Local Datum",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]</reference>
    <region>
      <center>-9.8436779195041488e+000 -7.3705657976929828e-001 -1.7762507007852612e+001</center>
      <size>3.9544194889068606e+001 2.9170695590972898e+001 1.2335178852081299e+001</size>
      <R>-9.7696195018876653e-001 5.3160571456828648e-002 -2.0668648123606301e-001 -2.1339985325919542e-001 -2.5431870189253702e-001 9.4328283165583415e-001 -2.4187832304521230e-003 9.6565829956050098e-001 2.5980415311847072e-001</R>
    </region>

It would be great if someone could help me with this. Thanks very much.



James

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Transformation matrix between pointcloud and camera
« Reply #1 on: April 28, 2019, 06:50:51 PM »
It's been a while since i dabbled, but i believe that the final transform converts metashape's inital 'guess' arbitrary world coordinate system into a user defined one, for example if you specified ground control points, scale bars, or manually rotated/scaled the model etc.

I'm not sure if points and cameras are therefore exported in the arbitrary system (so you would have to apply the final transform) or already tranformed into the user coordinate system, but i'm reasonably sure it's one or the other!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Transformation matrix between pointcloud and camera
« Reply #2 on: April 29, 2019, 03:33:31 PM »
Hello babotea,

If your project is referenced in Local Coordinates then the exported dense cloud would have the XYZ coordinates defined in this system, whereas to get the camera locations in the same coordinate system space you should multiply chunk.transform from the right to camera.transform and take the fourth row of the produced matrix as vector that defines the camera location in 3D space (same as dense cloud points).
Best regards,
Alexey Pasumansky,
Agisoft LLC