Ask Your Question
0

RGB To Depth mapping

asked 2013-03-24 22:54:14 -0500

Muhammad Atif gravatar image

updated 2014-01-28 17:15:52 -0500

ngrennan gravatar image

Hi All, I did try to search this kind of problem if someone already faced earlier but I did found If I missed I am sorry.So please guide.

I mapped the RGB to depth frame in ROS but it is not mapped correctly.

Can any one please guide me. Why its like this ?

edit retag flag offensive close merge delete

Comments

Are you using a stereo camera or some RGBD sensor like kinect?

Pep Lluis Negre gravatar image Pep Lluis Negre  ( 2013-03-24 23:21:16 -0500 )edit

I am using Microsoft Kinect and.....subscribed to the following..../camera/depth/points and /camera/rgb/image_color.....

Muhammad Atif gravatar image Muhammad Atif  ( 2013-03-25 00:45:52 -0500 )edit

You can use topic "/camera/depth_registered/points"

hiranya gravatar image hiranya  ( 2013-03-25 06:53:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-03-25 07:03:14 -0500

You can use topic "/camera/depth_registered/points" and callback function as follows

    void callback(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& msg){
      BOOST_FOREACH (const pcl::PointXYZRGB& pt, msg->points){
         ROS_INFO("\t(%f, %f, %f,%d, %d, %d)\n", pt.x, pt.y, pt.z,pt.r,pt.g,pt.b);
        }

in your main you can subscribe as follows

ros::Subscriber sub = nh.subscribe<pcl::PointCloud<pcl::PointXYZRGB> >("/camera/depth_registered/points", 1, callback);

Then you can get the points with RGB valuse :)

edit flag offensive delete link more

Comments

Thanks hiranya for your reply.It really works.My one question regarding the above code.Why "nan" values appear in it.2ndly How I can get the each pixel number to the corresponding information (xyz and rgb), because I am doing Image Identification I need that info also.thanks in advance..

Muhammad Atif gravatar image Muhammad Atif  ( 2013-03-25 15:48:48 -0500 )edit
  1. The nan values are value points that Kinect cannot capture depth information everywhere such as reflective surface, light-emitting surfaces etc. 2.There are two types of point clouds organized (get the each pixel number to corresponding 3d information)and unorganized.you need an organized one.
hiranya gravatar image hiranya  ( 2013-03-25 21:31:03 -0500 )edit

The above mentioned are organized or unorganized ?How to get the organized point clouds ?

Muhammad Atif gravatar image Muhammad Atif  ( 2013-03-25 21:48:38 -0500 )edit

yes its organized pcl. WIDTH 640* HEIGHT 480 hope you can get an idea from this http://pointclouds.org/documentation/tutorials/pcd_file_format.php about organized PCL.

hiranya gravatar image hiranya  ( 2013-03-26 09:01:08 -0500 )edit

It really works but with one problem.If we cut first 32 pixel then it works very well.I am trying to dig out this problem I did not found but if some one know please share with us."Matching of depth with RGB works when first 32 pixel removed."

Muhammad Atif gravatar image Muhammad Atif  ( 2013-03-28 16:00:12 -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

Stats

Asked: 2013-03-24 22:54:14 -0500

Seen: 501 times

Last updated: Mar 25 '13