Converting color coordinates to depthmap coordinates (Astra S)

Hey guys,
I’ve seen that OpenNI2 provides a function “convertDepthToColor” to calculate the 2D-coordinates in the RGB-frame from the given 3D-depthframe-coordinates.
I need this function the other way around. I determine a ROI in the RGB-frame and wanna get the corresponding x and y values in the depthframe to query the z value of my ROI.
Does OpenNI2 or Astra SDK provide a function like this ? Or should I code something by my own?

I’m thankful for every answer!
Best regards,

You don’t need the inverse function. Once the depth image has been registered into the RGB frame, there’s a 1-to-1 mapping between depth and RGB image coordinates. So once you have the (u, v) pixel coordinates in the RGB image, you can look up those coordinates in the depth image and get the z value.

In general, that “inverse function” you’re looking for cannot exist. It’s impossible to project a RGB image into another frame; you need the 3D coordinates to do that, so you can only project the depth image into the RGB frame but not vice versa.

thank you for your quick help !

Can you please tell me how can we register a depth image into RGB frame ?


1 Like

Hello Mintar,
may I know about the frequency of registered depth image topic in ROS? I hope you understood my point. I want to know about the topic depth_image (registered) publish rate in ROS. normally it’s 30Hz with raw_depth_image topic. so will it be same 30Hz with registered depth image?