Skip to content

How to set pycolmap BA parameter/s #2978

@mattiasmar

Description

@mattiasmar

How does one set max_num_iterations & max_linear_solver_iterations when calling pycolmap.bundle_adjustment?

options = pycolmap.BundleAdjustmentOptions()
pycolmap.bundle_adjustment(reconstruction, options)

As per the documentation the BundleAdjustmentOptions should hold these values, but not anymore in the latest commit.

Context:

#prior: reconstruction folder sfm_path with images.bin, cameras.bin, points3D.bin
os.makedirs(sfm_path,exist_ok=True)
rec.write(sfm_path)
  for _ in range(50):
      # Step 3: Perform triangulation using the existing camera poses
      triangulation.main(
          reference_model=sfm_path,
          sfm_dir = sfm_path,
          image_dir=Path(output_dir),
          pairs=sfm_pairs,
          features=features_path,
          matches=matches_path,
          verbose = False,
          skip_geometric_verification = True
      )
      # # Load the final reconstruction
      reconstruction = pycolmap.Reconstruction(sfm_path)

      # Define bundle adjustment options
      options = pycolmap.BundleAdjustmentOptions()
      options.refine_focal_length = False  # Do not refine focal length
      options.refine_principal_point = False  # Do not refine principal point
      options.refine_extra_params = False  # Do not refine extra parameters
      options.refine_extrinsics = True  # Refine extrinsics
      options.use_gpu = True
      pycolmap.bundle_adjustment(reconstruction, options)
      reconstruction.write(sfm_path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions