Skip to content

fix ros2 depth image conversion from float16 to float32 - #202

Merged
jonyMarino merged 1 commit into
mainfrom
fix/ros2_depth_image
Sep 2, 2026
Merged

fix ros2 depth image conversion from float16 to float32#202
jonyMarino merged 1 commit into
mainfrom
fix/ros2_depth_image

Conversation

@jonyMarino

Copy link
Copy Markdown
Contributor

Fixes: #

About

This pull request adds support for converting 16-bit floating point depth images (with encoding 16FC1) to 32-bit floating point images (32FC1) in the PopulateImagePayloadFromMsgpack function. It also includes a new unit test to verify this functionality and makes minor test includes updates.

Image conversion enhancements:

  • Updated PopulateImagePayloadFromMsgpack in ros2_conversion_utils.hpp to handle 16FC1 input by converting half-precision (16-bit) float depth images to single-precision (32-bit) float images, including proper memory allocation, byte handling, and NaN handling for non-finite values.

Testing improvements:

  • Added a new test NativeHalfDepthImagePayloadIsConvertedToFloat in ros2_conversion_utils_test.cpp to verify correct conversion from 16-bit half-precision to 32-bit float images, including checks for value conversion and NaN propagation.
  • Updated includes in ros2_conversion_utils_test.cpp to add <cmath> and <cstring> for math and memory operations needed by the new test.

How Has This Been Tested?

locally tested win+wsl2 echoing depth topic

Screenshots and videos (if appropriate):

@jonyMarino
jonyMarino merged commit d6c0a5c into main Sep 2, 2026
4 checks passed
@jonyMarino
jonyMarino deleted the fix/ros2_depth_image branch September 2, 2026 02:56
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