Forum

Author Topic: Transformation matrix  (Read 5694 times)

juls

  • Newbie
  • *
  • Posts: 2
    • View Profile
Transformation matrix
« on: November 29, 2018, 01:31:16 AM »
What is the best way to apply a transformation matrix?

I have a series of point clouds of the same location, and would like to create point clouds, orthomosaics, and DEMs at the same scale. One of the point clouds (A) is georeferenced, and the others (B, C, D) are not. I have made point clouds for each of these datasets in Agisoft, and have used Cloud Compare to calculate a transformation matrix needed to align B to A. (I'm using cloudcompare because they have an iterative closest point alignment tool that would give a much stronger alignment than the errors associated with manually picking control points in each chunk).

I've attempted a number of ways to bring that transformation matrix from Cloud Compare into Agisoft (script below). So far, it appears that the rotation is correct (generating a DEM or an orthomosaic is always oriented to the right projection), but the scale is off (generally measuring the same object in both clouds gives a difference ~ a factor of 2/3)

What is the actual structure of the Agisoft matrix for transforming (given the 4x4 matrix, what do each of the components mean), and what would be the best way to apply this kind of translation matrix to a point cloud?




#mymatrix =4x4 matrix for rigid body tranformation


doc=PhotoScan.app.document
chunk=doc.chunk
chunk.transform.matrix= mymatrix

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Transformation matrix
« Reply #1 on: November 29, 2018, 05:02:07 PM »
Hello juls,

Can you provide an example of the transformation matrix that you get from Cloud Compare? Also which coordinate system you are using for the dense cloud export?

As a debugging procedure I could suggest to estimate the transformation manually for a certain subset of points (like 100 - 1000) between the original unreferenced cloud and cloud that is transformed in Cloud Compare.

Best regards,
Alexey Pasumansky,
Agisoft LLC

juls

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Transformation matrix
« Reply #2 on: November 29, 2018, 05:58:19 PM »
Hi Alexey,

The georeferenced point cloud (A) is in UTM (51N). I exported the others in local coordinates (m). Then in CloudCompare, the transformation matrix looks like this:

1.103528 -0.441145 1.498212 -1620.791138
1.553641 0.497434 -0.997887 -492.023804
-0.159516 1.793034 0.645449 -385.839966
0.000000 0.000000 0.000000 1.000000

Because CloudCompare has applied a global shift to the georeferenced point cloud, I then add back in the global shift to the translation component (rightmost column). So the final matrix that I put in looks like:


1.103528 -0.441145 1.498212 351379.208862
1.553641 0.497434 -0.997887 2673507.976196
-0.159516 1.793034 0.645449 -385.839966
0.000000 0.000000 0.000000 1.000000

This means that I end up with a point cloud that appears to have the correct rotation, and the coordinates are close to UTM, but are all off by ~1-100 m. My guess was that Cloud Compare and Agisoft treat the scale differently in the transformation matrix (as each measured object is consistently off by about 30%), but I haven't been able to figure out exactly why.

I've been trying to do that debugging as well, but could you clarify what each of the components mean? Based on another of your posts: http://www.agisoft.com/forum/index.php?topic=1322.msg15758#msg15758, I can see that the top left 3x3 matrix deals with rotation (1a-3c in the example matrix below). But can you clarify what the other components mean?

1a    1b    1c    1d
2a    2b    2c    2d
3a    3b    3c    3d
4a    4b    4c    4d


Thank you!

MarineL

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Transformation matrix
« Reply #3 on: March 08, 2022, 01:24:37 PM »
Hi,
I was wondering if you had made any progress on this matter? I am also trying to co-register 2 point clouds (same location but different years) in cloudcompare then import the transformation matrix into Metashape. The reason I am not trying to co-register models in Metashape (yet) is because the point alignment won't work (the 2 clouds are not alike enough to do so) and I would like to avoid placing markers manually (we are planning to use the coded markers later but it is always tricky to place permanent markers underwater for yearly surveys!).

Unfortunately the script works but the model to be aligned isn't aligned with the reference model. I suspect it is due to the fact that cloudcompare gives the reference model the matrix [1,1,1,1] while this is not the case in Metashape.

Thanks!