Skip to content

fix(ldm3d): return uint16/int32 from rgblike_to_depthmap instead of casting back to uint8 - #14424

Open
AloysJehwin wants to merge 1 commit into
huggingface:mainfrom
AloysJehwin:fix/ldm3d-depthmap-truncation
Open

fix(ldm3d): return uint16/int32 from rgblike_to_depthmap instead of casting back to uint8#14424
AloysJehwin wants to merge 1 commit into
huggingface:mainfrom
AloysJehwin:fix/ldm3d-depthmap-truncation

Conversation

@AloysJehwin

Copy link
Copy Markdown
Contributor

Fixes #14206

rgblike_to_depthmap was combining two 8-bit channels into a 16-bit value (high * 256 + low), then casting the result back to the input uint8 dtype — truncating it. The numpy path fed that into numpy_to_depth which uses mode="I;16", causing ValueError: buffer is not large enough.

The fix: return the wider type directly. For numpy, uint16 matches the mode="I;16" consumer. For torch, int32 preserves the full value.

Verified: rgblike_to_depthmap(high_byte=200, low_byte=100) now returns 51300 (uint16) instead of truncating to 100.

…asting back to uint8

Signed-off-by: Aloys Jehwin <aloysjehwin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-issue size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LDM3D rgblike_to_depthmap truncates the 16-bit depth map back to the 8-bit input dtype

1 participant