Ask Your Question
1

How to obtain depth registered image from simulated Kinect in Gazebo ?

asked 2018-04-24 10:54:50 -0500

malharjajoo gravatar image

Hi,

I am new to using Kinect in gazebo_ros, and while I am able to publish (from Gazebo) the ROS topics given in this tutorial , however I do not understand how to obtain the depth-registered (registered with RGB image) images from the simulated Kinect.

Is there some way in ROS to get the depth registered image ?

The output of my rostopic list (after launching gazebo_ros with kinect model) is -

/camera/depth/camera_info
/camera/depth/image_raw
/camera/depth/image_raw/compressed
/camera/depth/image_raw/compressed/parameter_descriptions
/camera/depth/image_raw/compressed/parameter_updates
/camera/depth/image_raw/compressedDepth
/camera/depth/image_raw/compressedDepth/parameter_descriptions
/camera/depth/image_raw/compressedDepth/parameter_updates
/camera/depth/image_raw/theora
/camera/depth/image_raw/theora/parameter_descriptions
/camera/depth/image_raw/theora/parameter_updates
/camera/depth/points
/camera_ir/depth/camera_info
/camera_ir/parameter_descriptions
/camera_ir/parameter_updates

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-27 09:59:39 -0500

In my experience, whenever I've used a simulated Kinect in Gazebo the point cloud produced (in your case /camera/depth/points) is already an XYZRGB templated pointcloud; i.e. there are already depth and color fields filled out.

For example, using the turtlebot_simulator the header for a pointcloud produced on the /camera/depth/points topic is as follows:

header: 
  seq: 8148
  stamp: 
    secs: 996
    nsecs: 190000000
  frame_id: "camera_depth_optical_frame"
height: 480
width: 640
fields: 
  - 
    name: "x"
    offset: 0
    datatype: 7
    count: 1
  - 
    name: "y"
    offset: 4
    datatype: 7
    count: 1
  - 
    name: "z"
    offset: 8
    datatype: 7
    count: 1
  - 
    name: "rgb"
    offset: 16
    datatype: 7
    count: 1

Notice there are fields for position and color. For reference, the configuration for Kinect Gazebo plugin used by the turtlebot sim is here. As an additional piece of info, note that this snippet of code is where the simulated depth map is turned into a point cloud inside of the Kinect Gazebo plugin, and you can see they also add the RGB fields.

I suppose it would be possible to instead mimic something like freenect_launch and use depth_image_proc to register the RBG/depth map, and build the point cloud outside of the Gazebo plugin (if you had a need for such a thing).

edit flag offensive delete link more

Comments

Sorry I'm not clear. The code snippet you pointed makes sense although I don't know what double hfov = this->parentSensor->DepthCamera()->HFOV().Radian(); and related stuff does.

Regardless, are you trying to say that the pointcloud provided here is the same as a depth registered image ?

malharjajoo gravatar image malharjajoo  ( 2018-04-27 17:35:30 -0500 )edit

It's not the same as a depth registered image (it's a pointcloud). However, when running a real Kinect the pointcloud contained in the depth_registered namespace (e.g. /camera/depth_registered/points) is an XYZRGB pointcloud just like this one is. If that's ultimately what you're looking for....

jarvisschultz gravatar image jarvisschultz  ( 2018-04-30 09:37:45 -0500 )edit

... then this topic already contains that information.

jarvisschultz gravatar image jarvisschultz  ( 2018-04-30 09:38:04 -0500 )edit

Hi, I am looking for a depth-registered image and not a registered pointcloud (unless there is a way to get the depth-registered image from the pointcloud). This is mainly because ROS Object Recognition Kitchen (ORK) requires this topic.

malharjajoo gravatar image malharjajoo  ( 2018-04-30 09:43:23 -0500 )edit

I haven't spent much time studying the code, but in a quick test, it looks to me like /camera/depth/image_raw and the /camera/rgb/image_raw are already expressed in the same coordinate system. Perhaps you could pass those topics to ORK?

jarvisschultz gravatar image jarvisschultz  ( 2018-05-01 07:15:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-04-24 10:54:50 -0500

Seen: 1,338 times

Last updated: Apr 27 '18