[RSDK-13824] Fix depth image scale by applying Orbbec SDK valueScale#72
Merged
SebastianMunozP merged 2 commits intoviam-modules:mainfrom Apr 27, 2026
Merged
Conversation
The previous implementation divided raw depth values by 1000 before storing them as uint16_t mm values, compressing all distances into the 0-1 mm range. Additionally, getValueScale() was never applied, meaning cameras with a non-1.0 scale factor would produce wrong values. Now encode_to_depth_raw accepts a valueScale parameter and computes actual_mm = raw_pixel * valueScale before encoding. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
seanavery
approved these changes
Apr 27, 2026
Contributor
seanavery
left a comment
There was a problem hiding this comment.
Nice improvement!
[question] Was the old depth image return effectively unusable with the old 0-1mm normalization?
[question] Do we currently have any users of the depth image that will be affected by this change?
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous implementation divided raw depth values by 1000 before storing them as uint16_t mm values, compressing all distances into the 0-1 mm range. Additionally, getValueScale() was never applied, meaning cameras with a non-1.0 scale factor would produce wrong values.
Now encode_to_depth_raw accepts a valueScale parameter and computes actual_mm = raw_pixel * valueScale before encoding.
This fix is based on the example from Orbbec: https://github.com/orbbec/OrbbecSDK_v2/tree/main/examples/1.stream.depth
Test (using a simple python script to print the images we receive from the camera)
Before:
After: