Skip to content

feat(3d): expose the left rectifying rotation on StereoRectifier#940

Merged
cjpurackal merged 1 commit into
mainfrom
feat/stereo-rectifier-left-rotation
Jun 18, 2026
Merged

feat(3d): expose the left rectifying rotation on StereoRectifier#940
cjpurackal merged 1 commit into
mainfrom
feat/stereo-rectifier-left-rotation

Conversation

@cjpurackal

Copy link
Copy Markdown
Member

What

Stores the left rectifying rotation (rect_l, already computed in StereoRectifier::from_calib to build the remap tables) on the struct and adds a left_rectifying_rotation() getter.

Why

The rectified virtual camera is the raw left camera rotated by the Bouguet rectifying rotation (p_rect = R_rect · p_left_raw). Any extrinsic calibrated against the raw camera frame therefore has to be re-expressed before it can be used with rectified images — most importantly a camera-IMU T_BS:

T_B,rect = T_BS · R_rectᵀ    (translation unchanged)

Without access to R_rect, visual-inertial pipelines running on rectified stereo (e.g. kornia-slam's stereo-inertial mode on EuRoC) cannot relate IMU preintegration deltas (body frame) to the rectified camera poses, which silently corrupts the estimated gravity direction.

Verified downstream in kornia-slam: stereo-inertial init on EuRoC MH_01 recovers the same physical gravity vector as the mono (unrectified) path, re-expressed in the rectified frame, and a gyro bias matching the known sensor bias.

Changes

  • StereoRectifier: new private rect_left: Mat3F64 field, populated in from_calib
  • new getter left_rectifying_rotation() -> Mat3F64

No behavior changes; existing stereo tests pass.

from_calib already computes the rotation mapping raw left-camera
coordinates into the rectified frame (rect_l) to build the remap table;
store it and add a getter so callers can re-express raw-frame extrinsics
for the rectified virtual camera. Concretely, a camera-IMU T_BS calibrated
against the raw left camera becomes T_B,rect = T_BS * R_rect^T, which
visual-inertial pipelines need to run on rectified stereo.
Copilot AI review requested due to automatic review settings June 12, 2026 16:09
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions

Copy link
Copy Markdown

⚠️ PR Validation Warnings

No linked issue found: This PR does not reference any issue. Please link to an issue using "Fixes #123" or "Closes #123" in the PR description.


Note: This PR can remain open, but please address these issues to ensure a smooth review process. For more information, see our Contributing Guide.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends kornia-3d’s stereo rectification API by persisting the already-computed Bouguet left rectification rotation on StereoRectifier and exposing it via a getter, enabling downstream consumers to re-express raw-frame extrinsics into the rectified virtual camera frame.

Changes:

  • Add a private rect_left: Mat3F64 field to StereoRectifier, populated in StereoRectifier::from_calib.
  • Add StereoRectifier::left_rectifying_rotation() -> Mat3F64 to expose the left rectifying rotation.

Comment thread crates/kornia-3d/src/stereo/rectify.rs
Comment thread crates/kornia-3d/src/stereo/rectify.rs
@cjpurackal cjpurackal requested a review from edgarriba June 13, 2026 17:36
@cjpurackal

cjpurackal commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@edgarriba can you merge this? It currently blocks kornia/kornia-slam#45 from merging

@cjpurackal cjpurackal merged commit b8da6d1 into main Jun 18, 2026
27 of 28 checks passed
@cjpurackal cjpurackal deleted the feat/stereo-rectifier-left-rotation branch June 18, 2026 09:31
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

Successfully merging this pull request may close these issues.

3 participants