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
11 changes: 7 additions & 4 deletions lamaria/structs/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,17 @@ def _add_images_to_reconstruction(

image_id = 1
Copy link
Member

Choose a reason for hiding this comment

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

This won't work if the reconstruction already has images, cameras, or rigs, should we assert this? or make this code more generic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is a hidden function that we don't want to expose. We only use it to add estimate poses to an already initialized reconstruction:

def add_estimate_poses_to_reconstruction(
self,
reconstruction: pycolmap.Reconstruction,
timestamp_to_images: dict,
) -> pycolmap.Reconstruction:
"""
Adds estimate poses as frames to input reconstruction.
"""
self._ensure_loaded()
reconstruction = self._add_images_to_reconstruction(
reconstruction, timestamp_to_images
)
return reconstruction

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Whereas the more general function is to initialize the reconstruction with a calibration file (pinhole/Aria camera):

def initialize_reconstruction_from_calibration_file(

# imu is the rig in this reconstruction
rig = reconstruction.rig(rig_id=1)
imu_id = 1
left_camera_id = 2
right_camera_id = 3

rig = reconstruction.rig(rig_id=imu_id)

if self.corresponding_sensor == "imu":
transform = pycolmap.Rigid3d()
else:
# left camera poses are provided
# sensor_from_rig == cam0_from_imu
left_camera_id = 2
left_camera = reconstruction.cameras[left_camera_id]
transform = rig.sensor_from_rig(sensor_id=left_camera.sensor_id)

Expand All @@ -278,8 +281,8 @@ def _add_images_to_reconstruction(
images_to_add = []

for label, camera_id in [
(LEFT_CAMERA_STREAM_LABEL, 2),
(RIGHT_CAMERA_STREAM_LABEL, 3),
(LEFT_CAMERA_STREAM_LABEL, left_camera_id),
(RIGHT_CAMERA_STREAM_LABEL, right_camera_id),
]:
source_timestamps = timestamp_to_images[label]["sorted_keys"]
# offsets upto 1 ms (1e6 ns)
Expand Down