Forum

Author Topic: Unable to reproduce behavior using the python interface  (Read 7130 times)

sarnold

  • Newbie
  • *
  • Posts: 3
    • View Profile
Unable to reproduce behavior using the python interface
« on: October 29, 2021, 07:21:06 PM »
Hi,
using the GUI I can set some camera parameters fixed and let others optimize for each camera.
The camera xml output lists the initial calibration, the adjusted calibration and a calibration block for each camera with the parameters that have been optimized for each camera.
The same output I was expecting after calling matchPhotos and alignCameras using the python interface.
In order to optimize the right parameters the following has been set:
sensor.fixed_params = ["F", "Cx", "Cy"]
sensor.photo_params = ["P1", "P2", "K1", "K2", "K3"]
and an initial calibration has been set on sensor.user_calib.

The camera xml however shows no optimized camera calibration parameters, only the initial settings.
What is missing here compared to the behavior of calling Align Photos in the GUI?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15745
    • View Profile
Re: Unable to reproduce behavior using the python interface
« Reply #1 on: October 29, 2021, 08:11:35 PM »
Hello sarnold,

Can you please specify, which parameters you are using for matchPhotos,  alignCameras and optimizeCameras commands?
Best regards,
Alexey Pasumansky,
Agisoft LLC

sarnold

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Unable to reproduce behavior using the python interface
« Reply #2 on: November 01, 2021, 11:54:34 AM »
Hello Alexey,
those are the parameters:
Code: [Select]
matchPhotos(downscale=1, generic_preselection=True, reference_preselection=True,
                    reference_preselection_mode=Metashape.ReferencePreselectionEstimated, filter_mask=False,
                    mask_tiepoints=True, keypoint_limit=40000, tiepoint_limit=2000,
                    keep_keypoints=True, guided_matching=False, reset_matches=False, subdivide_task=True, workitem_size_cameras=20,
                    workitem_size_pairs=80, max_workgroup_size=100, progress=progress_print) 
Code: [Select]
alignCameras(min_image=2, adaptive_fitting=False, reset_alignment=True, subdivide_task=True, progress=progress_print)
Code: [Select]
optimizeCameras(fit_f=False, fit_cx=False, fit_cy=False)
Calling optimizeCameras after alignCameras is an optional step right? I assume that the camera calibration parameters are already optimized during the alignCameras step.


sarnold

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Unable to reproduce behavior using the python interface
« Reply #3 on: November 01, 2021, 04:04:03 PM »
It seems that the parameters are optimized as intended, they are just not saved into the camera xml output.
Interestingly after calling optimizeCameras with fit_corrections=True the parameters are present in the xml as expected.