diff --git a/framework/util/image_writer.cpp b/framework/util/image_writer.cpp index c312c9c390..4f6fc79b81 100644 --- a/framework/util/image_writer.cpp +++ b/framework/util/image_writer.cpp @@ -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(normalized_depth) / 8388607.0f; - const uint8_t depth = static_cast(float_depth * 255.0f); + const float float_depth = static_cast(normalized_depth) / static_cast(0xffffff); + const uint8_t depth = static_cast(float_depth * 255.0f); *(temp_buffer++) = depth; *(temp_buffer++) = depth; @@ -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(normalized_depth) / 32767.0f; + const float float_depth = static_cast(normalized_depth) / static_cast(0xffff); const uint8_t depth = static_cast(float_depth * 255.0f); *(temp_buffer++) = depth;