I've got a script that can read in a processed LIDAR scan from a .ply file, and also read in a set of images. The scan and images are of the inside of a room. The LIDAR has been set to the desired scene origin, floor plane and being lidar, has the correct scene scale. I want Metashape to solve the camera positions relative to that LIDAR, and not move or rescale the point cloud. So far, all my solves output a decent camera alignment but that alignment is not aligned to the input point cloud.
Currently my script imports the points:
chunk.importPointCloud(
path=ply_path,
format=Metashape.PointCloudFormat.PointCloudFormatPLY,
is_laser_scan=True
)
then add the images
supported_ext = [".jpg", ".jpeg", ".tif", ".tiff", ".png"]
photo_list = [
os.path.join(image_folder, f) for f in os.listdir(image_folder)
if os.path.splitext(f)[1].lower() in supported_ext
]
chunk.addPhotos(photo_list)
matches, aligns and optimises cameras:
chunk.matchPhotos(
downscale=1,
generic_preselection=True,
reference_preselection=False,
keypoint_limit=40000,
tiepoint_limit=10000
)
chunk.alignCameras()
chunk.optimizeCameras(
fit_f=True, fit_cx=True, fit_cy=True,
fit_b1=False, fit_b2=False,
fit_k1=True, fit_k2=True, fit_k3=True,
fit_p1=True, fit_p2=True
)
exports as colmap
chunk.exportCameras(
path=os.path.join(output_path, "cameras.txt"),
format=Metashape.CamerasFormatColmap
)
How do I ensure the camera alignment respects my input lidar sourced point cloud?