ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

kinect depth and rgb registration

asked 2015-08-28 21:16:31 -0500

dmngu9 gravatar image

Hi, im able to have rgb point cloud by registration using openni rqt_reconfigure. however, i want to access a pixel in rgb image (camera image_color topic) and find its depth. Which topic should i subscribe depth_registered/image_raw or depth_registered/rect.

I looked at the . There is no depth in it. How can i access depth value

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-08-29 16:55:37 -0500

duck-development gravatar image

The Kinect has the problem that not every pixel have an depth value. So it is not easy the get the depth of an pixel.

edit flag offensive delete link more


hi, i want to save 1 frame of depth registered image raw but it gives me error when i run image_view and right click to save 1 frame because its not in brg8 format. how can i save a depth map

dmngu9 gravatar image dmngu9  ( 2015-08-29 19:37:07 -0500 )edit

answered 2015-08-31 22:45:48 -0500

Yake gravatar image
        depthsub_ = it_.subscribeCamera(depth_image_topic, 1, &FrameDrawer::depthImageCb, this);

void depthImageCb(const sensor_msgs::ImageConstPtr& image_msg, const sensor_msgs::CameraInfoConstPtr& info_msg)

    cv::Mat image;
    cv_bridge::CvImageConstPtr input_bridge;
    try {
    input_bridge = cv_bridge::toCvCopy(image_msg, sensor_msgs::image_encodings::TYPE_16UC1);// For depth image
//     input_bridge = cv_bridge::toCvCopy(image_msg, sensor_msgs::image_encodings::TYPE_32FC1);// For depth image

      image = input_bridge->image;
    catch (cv_bridge::Exception& ex){
      ROS_ERROR("[draw_frames] Failed to convert image");
cv::Point3d xyz = cam_model_.projectPixelTo3dRay(pixel_point);  // cv::Point3d ray;
                                                                      //  ray.x = (uv_rect.x - cx() - Tx()) / fx();
                                                                      //  ray.y = (uv_rect.y - cy() - Ty()) / fy();
                                                                      //  ray.z = 1.0;
                                                                      //  return ray;

I have the same question wiht you, even not every pixel has a depth with it , it maybe because the direction of camera or some obstacle before the target. Above is just get the 2d point and the 3d ray, but I don't understand what is the next to get the specific point in 3D

edit flag offensive delete link more

Question Tools



Asked: 2015-08-28 21:16:31 -0500

Seen: 1,163 times

Last updated: Aug 31 '15