Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: Yoann Courtois on February 14, 2020, 08:00:47 PM
-
Dear Agisoft team,
Within an automated workflow, we would need to update the transformation of a chunk, including a imported dense cloud.
However, even if the point cloud import is done before the transformation, basic stuff (images + tie points) are transformed but the dense cloud remain at the imported coordinates.
Is it possible to include all 3D datas in updateTransform() command ? Or may it exist any solution to transform the dense cloud together with the rest of the chunk ?
P.S. I know it is impossible to "optimize" a dense cloud. What I would need is only apply a basic Helmert transform on this cloud.
Regards
-
Hello Yoann,
Imported dense cloud by default has its own transformation dense_cloud.transform and coordinate system dense_cloud.crs.
To disable "Lock Transform" option via Python you should complete following steps:
dense_cloud.transform = Metashape.Matrix().Diag([1,1,1,1])
dense_cloud.crs = None
In this case the dense cloud would be affected by the applied chunk.transform as other elements of the chunk.
-
Hello Alexey,
Thanks for your reply,
After some investigations, it looks those steps don't affect dense_cloud "locked" transformation :
-> dense_cloud.transform is already a diagonal matrix
-> dense_cloud.crs is <CoordinateSystem 'Local Coordinates'>, but set to None doesn't change anything.
I was able to find a workaround by saving chunk.transform.matrix before and after updateTransform() command.
Then, I apply :
chunk.dense_cloud.transform = Metashape.Matrix().Diag([1,1,1,1]) * previous_chunk_transform_matrix * new_chunk_transform_matrix.inv()
The dense cloud take the right new location, but then following treatments don't work correctly anymore (like dense_cloud classification, etc...)
Looking forwards to your help.
Regards
-
May I have some help about that ?
-
Hello Yoann,
If the following code doesn't help, please send the project with "locked" dense cloud but which is not affected by any script commands, so that I could check it?
chunk.dense_cloud.crs = None
chunk.dense_cloud.transform = chunk.transform.matrix.inv() * chunk.dense_cloud.transform