Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map depth image in Unorm16 for full range #2016

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions framework/util/image_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ static const uint8_t* ConvertIntoTemporaryBuffer(uint32_t width,
for (uint32_t x = 0; x < width; ++x)
{
const uint32_t normalized_depth = bytes_u32[x] & 0x00FFFFFF;
const float float_depth = static_cast<float>(normalized_depth) / 8388607.0f;
const uint8_t depth = static_cast<uint8_t>(float_depth * 255.0f);
const float float_depth = static_cast<float>(normalized_depth) / static_cast<float>(0xffffff);
const uint8_t depth = static_cast<uint8_t>(float_depth * 255.0f);

*(temp_buffer++) = depth;
*(temp_buffer++) = depth;
Expand All @@ -301,7 +301,7 @@ static const uint8_t* ConvertIntoTemporaryBuffer(uint32_t width,
for (uint32_t x = 0; x < width; ++x)
{
const uint16_t normalized_depth = bytes_u16[x];
const float float_depth = static_cast<float>(normalized_depth) / 32767.0f;
const float float_depth = static_cast<float>(normalized_depth) / static_cast<float>(0xffff);
const uint8_t depth = static_cast<uint8_t>(float_depth * 255.0f);

*(temp_buffer++) = depth;
Expand Down