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

depth_image_to_color_camera not working #2

Open
iscsrl opened this issue Mar 12, 2020 · 1 comment
Open

depth_image_to_color_camera not working #2

iscsrl opened this issue Mar 12, 2020 · 1 comment

Comments

@iscsrl
Copy link

iscsrl commented Mar 12, 2020

Using the provided example the following function seams not to work properly:
img=transformation.depth_image_to_color_camera(img)

Could you provide a working example on how to fit the depth image to the color one?

@iscsrl
Copy link
Author

iscsrl commented Mar 18, 2020

I ended up uderstanding how to fix it.
First there is a litle bug in the depth.numpy function. The correct one is:

case k4a_image_format_t::K4A_IMAGE_FORMAT_DEPTH16:
case k4a_image_format_t::K4A_IMAGE_FORMAT_IR16:
   return py::array(
       py::buffer_info(
           _image.get_buffer(),
           sizeof(unsigned short int),
           py::format_descriptor<unsigned short int>::format(),
           2,
           {_image.get_height_pixels(), _image.get_width_pixels()},
           {
               sizeof(unsigned short int) * _image.get_width_pixels(),
               sizeof(unsigned short int)
           }
       )
   );

You should change the following line:
sizeof(unsigned short int) * _image.get_height_pixels(),
to:
sizeof(unsigned short int) * _image.get_width_pixels(),

And you should add to your example following:

depth = transformation.depth_image_to_color_camera(depth)
depth_color = transformation.depth_image_colorize_numpy(depth, config.depth_mode)

depth = depth.numpy()

Could you please provide the fixes and publish again the lib on PyPi?

Thank you in advance.

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

No branches or pull requests

1 participant