Azure-Kinect-Sensor-SDK
Azure-Kinect-Sensor-SDK copied to clipboard
allow IR16 format in k4a_transformation_depth_image_to_color_camera_custom()
I request two lines of additional code be added to allow K4A_IMAGE_FORMAT_IR16 to be used as input into k4a_transformation_depth_image_to_color_camera_custom()
. I see only benefit and no harm for the trivial change.
This is highly related to https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/1188
Scenario
Transform the IR image from its native resolution into the color camera's resolution.
Problem Cause
k4a_transformation_depth_image_to_color_camera_custom()
is artificially limited to only accept K4A_IMAGE_FORMAT_CUSTOM8 and K4A_IMAGE_FORMAT_CUSTOM16. Yet the entire workflow for it actually can support also K4A_IMAGE_FORMAT_IR16.
The artificial limitation is
https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/61951daac782234f4f28322c0904ba1c4702d0ba/src/transformation/rgbz.c#L738-L743
and
https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/61951daac782234f4f28322c0904ba1c4702d0ba/src/transformation/rgbz.c#L843
Updated code could be similar to...
k4a_image_format_t custom_format = K4A_IMAGE_FORMAT_CUSTOM8;
if ((custom_image_descriptor->format == K4A_IMAGE_FORMAT_CUSTOM16) ||
(custom_image_descriptor->format == K4A_IMAGE_FORMAT_IR16))
{
custom_bytes_per_pixel = 2;
custom_format = custom_image_descriptor->format;
}
...and...
else if ((custom_image_descriptor->format == K4A_IMAGE_FORMAT_CUSTOM16) ||
(custom_image_descriptor->format == K4A_IMAGE_FORMAT_IR16))
Why Fix?
- Reduces issues to manage like this one you are reading and #1188.
- Reduces customer dev/test churn to use transform API in a way they expect it to work, but the API doesn't work
- Reduces CPU and memory usage. The workaround to
k4a::image::create_from_buffer()
wrap around the already existing IR16 is wasteful of both CPU and memory. - Doesn't break any compatibility.