Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - michael.baltazar

Pages: [1]
1
Python and Java API / Alignment results different from API vs. GUI
« on: May 01, 2024, 10:03:31 PM »
Hi - a message from one of our developers:
 
I am trying to use the python API to do the following steps:

  • Unlock transforms:
Code: [Select]
for point_cloud in chunk.point_clouds:
    point_cloud.crs = None
  • Reset chunk transforms:
Code: [Select]
chunk.crs = None
chunk.transform.matrix = None
  • Reset alignment:
Code: [Select]
for camera in chunk_.cameras:
    camera.transform = None
  • Align laser scans:
Code: [Select]
chunk_.matchPhotos(
    downscale=1,
    keypoint_limit=10000000,
    tiepoint_limit=0,
    generic_preselection=True,
    reference_preselection=False
)
chunk_.alignCameras(
    min_image=2,
    adaptive_fitting=False,
    reset_alignment=True
)

    But the results are very different if I run the process via code or if I use the GUI.
    Specially during the "reset alignment" step, with the GUI my cameras and points are going to disappear from the Model View and the group will then say (Laser Scans (0/6 aligned)), which is what we want.

    (image 1)

    By code, I'll just see a "NA" next to the point cloud's photo (not the point cloud).

    (image 2)

    I have been looking for a while a way to reproduce the "reset alignment" step using python but I have been unsuccessful so far. Any help would be much appreciated. Thanks!


    2
    Bug Reports / Diffeent camera positions - headless vs. interactive
    « on: April 30, 2024, 02:26:24 AM »
    Hi - one of our developers is running into an issue with Metashape with different results in coming positions occurring between interactive mode and headless mode.  Here's the details from him:

    I am encountering an issue where importing laser scans (6 cameras from a single .e57 file) using the python API, so with a headless Metashape 2.1.1. It will mess up the positions of the cameras, except for the first one. This will not happen if I import the same file manually in Metashape or if I run the same script in Metashape, the issue is only with the command lines.

    The first camera of the laser scan file will always have the correct position but not the following ones. 

    I also tried to import cameras one by one (from 6 different files instead of 1) and the issue was the same but I found a temporary workaround: if I import all the cameras in separate chunks and then merge the chunks together, they will all have the desired position.

    Here is an example:

    The chunk1-wrong chunkwas created using the following script :

    Code: [Select]
    import Metashape
    doc = Metashape.Document()
    chunk = doc.addChunk()
    laser_scan_path = "my/e57/path"
    chunk.importPointCloud(path=laser_scan_path, format=Metashape.PointCloudFormatE57, is_laser_scan=True)
    doc.save(path=str(output_project_file), chunks=[chunk])

    (image 1)

    Positions are not correct.

    If, in the same file or another one, I create another chunk, chunk1-good, and I run the exact same commands (the chunk.importPointCloud part), or if I simply import the laser scans from the menu, the positions will be correct :

    (image 2)

    I did some tests with another data set and also tried to change some arguments of importCloudPoint, like precision and scanner_at_origin but it didn't change the results.

    Versions are the same : 2.1.1 but build are different, 17821 versus 17803.

    I would very much appreciate some help please.

    Thank you!



    Pages: [1]