Skip to content

feat: ROSBag depth_units returns depth images as float32 metres - #187

Merged
petercorke merged 2 commits into
mainfrom
feat/rosbag-depth-units
Nov 20, 2026
Merged

petercorke merged 2 commits into
mainfrom
feat/rosbag-depth-units

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Adds depth_units=None | "auto" | float to ROSBag. A depth image is returned as float32 metres, and its depth_units is then 1.0. "auto" uses the RealSense footer, else the unit REP 118 gives for the encoding (16UC1 millimetres, 32FC1 metres). A number is the scale in metres per unit. A depth image is a footer-bearing image, or a 16UC1/mono16/32FC1 image on a topic whose name contains "depth".

The RealSense SDK writes depth as mono16, which REP 118 does not cover, so with no footer (Intel's sample bags) "auto" does not guess: it returns the image as recorded and issues a RuntimeWarning, once per topic. The default (None) is unchanged, and colour is never touched. The docstring explains REP 118.

Checked on the real bags in bags/. The invalid_is_nan option is not in this PR.

Refs #151

🤖 Generated with Claude Code

petercorke and others added 2 commits November 20, 2026 13:42
depth_units="auto" finds the scale for each depth image: the footer of a RealSense bag,
else the unit REP 118 gives for the encoding (16UC1 is millimetres, 32FC1 is metres).  A
number is the scale in metres per unit.  The RealSense SDK writes depth as mono16, which has
no unit in REP 118, so without a footer (Intel's sample bags) "auto" does not guess: it
returns the image as recorded with a RuntimeWarning.  The default is unchanged.  Checked
against the real bags in bags/.

Refs #151

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 35 complexity · 0 duplication

Metric Results
Complexity 35
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 156d787 into main Nov 20, 2026
34 checks passed
@petercorke
petercorke deleted the feat/rosbag-depth-units branch November 20, 2026 04:09
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
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.

1 participant