Enable dynamic calibration for NeuralDepth and Rectification nodes #1579
Enable dynamic calibration for NeuralDepth and Rectification nodes #1579
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Are there any updates available? I would like to enable this feature to enhance the stereo effect. |
|
CC: @moratom |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThis change updates a CMake version variable, removes an unused include from the ToF header, and modifies the Rectification node to detect EEPROM changes and reinitialize rectification matrices accordingly instead of enforcing platform validation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pipeline/node/Rectification.cpp (1)
109-145:⚠️ Potential issue | 🟠 MajorTrack calibration changes from the same source you apply.
Lines 109-145 watch
getParentPipeline().getEepromId(), but Line 150 rebuilds maps fromgetCalibrationData(), which switches todevice->readCalibration()whendeviceis present. In that path, a device-side calibration update can leave the pipeline EEPROM ID unchanged, soinitializednever resets and rectification keeps using stale maps. Please derive the change token from the same calibration source used forR/T.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pipeline/node/Rectification.cpp` around lines 109 - 145, The code currently uses getParentPipeline().getEepromId() (latestEepromId/currentEepromId) to decide when to reset initialized, but R/T and map rebuilding use getCalibrationData() (which may call device->readCalibration()), so change detection must use the same calibration source: replace or supplement the EEPROM-based token with a token derived from getCalibrationData() (e.g., a calibration version/id field or a stable hash of the calibration blob returned by getCalibrationData()/device->readCalibration()) and compare that token each loop to set initialized = false when it changes; update references to latestEepromId/currentEepromId to use this calibrationToken and ensure the token is computed before map rebuilding logic in Rectification.cpp.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/pipeline/node/Rectification.cpp`:
- Around line 109-145: The code currently uses getParentPipeline().getEepromId()
(latestEepromId/currentEepromId) to decide when to reset initialized, but R/T
and map rebuilding use getCalibrationData() (which may call
device->readCalibration()), so change detection must use the same calibration
source: replace or supplement the EEPROM-based token with a token derived from
getCalibrationData() (e.g., a calibration version/id field or a stable hash of
the calibration blob returned by getCalibrationData()/device->readCalibration())
and compare that token each loop to set initialized = false when it changes;
update references to latestEepromId/currentEepromId to use this calibrationToken
and ensure the token is computed before map rebuilding logic in
Rectification.cpp.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3fec1c7f-944b-4700-b743-de60912c9ac5
📒 Files selected for processing (3)
cmake/Depthai/DepthaiDeviceRVC4Config.cmakeinclude/depthai/pipeline/node/ToF.hppsrc/pipeline/node/Rectification.cpp
💤 Files with no reviewable changes (1)
- include/depthai/pipeline/node/ToF.hpp
The two nodes mentioned should now update their rectification meshes whenever a change in the calibration data is detected. This all is to enable dynamic calibration to have affect on these nodes.
Screencast.from.2025-12-09.00-02-11.webm
For testing, feel free to use the following script that artificially perturbs the calibration data and then lets the dynamic calibration node recover the original extrinsic parameters:
neural_depth.py
Summary by CodeRabbit
Bug Fixes
Chores