Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lamaria/structs/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ def _add_images_to_reconstruction(
else:
# left camera poses are provided
# sensor_from_rig == cam0_from_imu
transform = rig.sensor_from_rig(sensor_id=2)
left_camera = reconstruction.cameras[2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 2? Try to avoid magic numbers or at least document them properly using a variable with unambiguous name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updating the naming for better clarity, the 2 for left camera comes from this function here where we build an initial reconstruction from a device calibration (for evaluation of each sequence).

def initialize_reconstruction_from_calibration_file(
calibration_file: Path,
) -> InitReconstruction:
"""Initialize a COLMAP reconstruction from Aria calibration
json file found on website: https://lamaria.ethz.ch/slam_datasets
Adds a dummy camera as an IMU along with two cameras.
Args:
calibration_file (Path):
Path to the Aria calibration json file
Returns:
InitReconstruction: The initialized COLMAP reconstruction
"""
reconstruction = pycolmap.Reconstruction()
imu = pycolmap.Camera(camera_id=1, model="SIMPLE_PINHOLE", params=[0, 0, 0])
reconstruction.add_camera(imu)
rig = pycolmap.Rig(rig_id=1)
ref_sensor = pycolmap.sensor_t(
id=1, # imu is the rig
type=pycolmap.SensorType.CAMERA,
)
rig.add_ref_sensor(ref_sensor)
for i, (key, _) in enumerate(ARIA_CAMERAS):
cam = camera_colmap_from_json(
calibration_file=calibration_file,
camera_label=key,
)
cam.camera_id = i + 2 # start from 2 since 1 is imu
reconstruction.add_camera(cam)
sensor = pycolmap.sensor_t(id=i + 2, type=pycolmap.SensorType.CAMERA)
rig_from_sensor = get_t_imu_camera_from_calibration_file(
calibration_file=calibration_file,
camera_label=key,
)
sensor_from_rig = rig_from_sensor.inverse()
rig.add_sensor(sensor, sensor_from_rig)
reconstruction.add_rig(rig)
return reconstruction

transform = rig.sensor_from_rig(sensor_id=left_camera.sensor_id)

for i, (timestamp, pose) in tqdm(
enumerate(pose_data),
Expand Down