Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectified images and annotation #16

Open
Shashvatb opened this issue Oct 10, 2024 · 2 comments
Open

Rectified images and annotation #16

Shashvatb opened this issue Oct 10, 2024 · 2 comments
Assignees

Comments

@Shashvatb
Copy link

Hi @SeaOtocinclus ,

Is there a way to easily obtain rectified images along with the annotations (bbox, camera calib, 2D keypoints) which is inbuilt?

thanks for all the help!

@SeaOtocinclus
Copy link
Contributor

Hi @Shashvatb ,

Context

  • As GT information has been computed for the FishEye camera model, projecting them directly on Linear rectilinear camera would not directly make sense (i.e a amodal Bounding Box for a FishEye image does not map to a Bounding Box on a Linear image.)

Recommendation

  • We would advise you to directly project 3D models on the Linear Image/Camera and compute their amodal bounding box after projection.

Here some tips on how to retrieve image/camera and manage world to camera projection

Image rectification & Linear Camera model

Retrieving Camera Calibration Code
Aria [T_device_camera, pinhole_camera_online_calibration] = (self.get_online_camera_calibration(stream_id, timestamp_ns=timestamp_ns, camera_model=LINEAR))
Quest [T_device_camera, pinhole_camera_calibration] = self.get_camera_calibration(stream_id, camera_model=LINEAR)

World to Camera projection

You can then use the camera calibration to project a world 3D point as following (see #14):

  • pinhole_camera_calibration.project( (headset_pose3d.T_world_device @ T_device_camera).inverse() @ X)

Loading 3D models

You can use trimesh to load the GT 3D models:

# Load the scene.
scene = trimesh.load_mesh(
    path,
    process=True,
    merge_primitives=True,
    skip_materials=True,
)

# Represent the scene by a single mesh.
mesh = scene.dump(concatenate=True)
  • You can then retrieve the vertices, move them to the right location given the pose of the 3D object at the given timestamp and project it to the image of your choice.

Comment about visibility

  • Visibility score should remain unchanged (we don't change how much of the object is seen) but do notice that the linear projection is cropping some image content and so limiting what is visible.

Comment on speed

  • You could subsample the mesh points to perform the world to camera projection

Final comments

  • We are planning soon to release a code example showing how to perform 3D model reprojection for Linear and FishEye images with pyrender and trimesh. It would enable you to perform a similar task, but using hardware rasterization rather than software projection.

@SeaOtocinclus SeaOtocinclus self-assigned this Oct 10, 2024
@Shashvatb
Copy link
Author

Thanks a lot for this information! Will use it accordingly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants