Drawing planes fitted to a cloud on a PPM file

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Drawing planes fitted to a cloud on a PPM file

Jun8
This post was updated on .
Hello,

I create a point cloud from depth and RGB images captured from the Kinect and am fitting multiple planes to it using PCL. What I want to do is to draw these planes on the RGB PPM image using OpenCV so that I can display the detected planes in an intuitively clear way.

My plan was to use pcl::getMinMax3D to get the min and max point for each inlier cloud and draw rectangles using cv::rectangle using the XY coordinates of these. The problem is that the XY coordinates of the cloud points are in meters whereas I need pixels to give to cv::rectangle(). Is there an easy way to do the conversion in PCL (or OpenCV) other than doing the perspective transformation?

If have a better way of displaying the planes, I'd like to hear about that, too.

EDIT: What I need it something similar to ROS's image_geometry::PinholeCameraModel::Project3DtoPixel method.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Drawing planes fitted to a cloud on a PPM file

Radu B Rusu
Administrator
If you're using trunk (or can wait until PCL 1.6.0 gets out), we already have a lot of 2D image processing and drawing
functions, including drawing planar inliers or polygons in 2D images, so you don't need to go through painful
projections at all. Just a thought.

See http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_image_viewer.html#ab67fc7734463f333ef483e0ec1eaeab0 
for more information.

Cheers,
Radu.

On 06/19/2012 02:45 PM, Jun8 wrote:

> Hello,
>
> I create a point cloud from depth and RGB images captured from the Kinect
> and am fitting multiple planes to it using PCL. What I want to do is to draw
> these planes on the RGB PPM image using OpenCV so that I can display the
> detected planes in an intuitively clear way.
>
> My plan was to use pcl::getMinMax3D to get the min and max point for each
> inlier cloud and draw rectangles using cv::rectangle using the XY
> coordinates of these. The problem is that the XY coordinates of the cloud
> points are in meters whereas I need pixels to give to cv::rectangle(). Is
> there an easy way to do the conversion in PCL (or OpenCV) other than doing
> the perspective transformation?
>
> If have a better way of displaying the planes, I'd like to hear about that,
> too.
>
> Thanks!
>
> --
> View this message in context: http://www.pcl-users.org/Drawing-planes-fitted-to-a-cloud-on-a-PPM-file-tp4019452.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Drawing planes fitted to a cloud on a PPM file

Jun8
Thanks Radu! I looked at the pcl::visualization:ImageViewer methods and it's *exactly* the thing that I need, I won't need OpenCV at all, it seems. I'm using trunk, so I can go ahead and use these.

One question though: I have XYZ clouds rather than XYZRGBA, the image is a separate PPM image. I saw that ImageViewer extracts the PPM image from the XYZRGBA cloud, am I out of luck? Is there any way to read in a PPM image (e.g. using OpenCV) and then add it as a layer to the XYZ cloud? If that's not possible, what would be the easiest way to add the RGB image info to the XYZ cloud to get a XYZRGBA cloud? As I'm generating the cloud, how can I pack and add the RGB value for each point?

Thanks for the help!
Reply | Threaded
Open this post in threaded view
|

Re: Drawing planes fitted to a cloud on a PPM file

Radu B Rusu
Administrator
Are you saying that you have the information decoupled (maybe in 2 separate files)? If so, can't you create the XYZRGBA
cloud and add the RGB information to it yourself?

Cheers,
Radu.

On 06/19/2012 06:51 PM, Jun8 wrote:

> Thanks Radu! I looked at the pcl::visualization:ImageViewer methods and it's
> *exactly* the thing that I need, I won't need OpenCV at all, it seems. I'm
> using trunk, so I can go ahead and use these.
>
> One question though: I have XYZ clouds rather than XYZRGBA, the image is a
> separate PPM image. I saw that ImageViewer extracts the PPM image from the
> XYZRGBA cloud, am I out of luck? Is there any way to read in a PPM image
> (e.g. using OpenCV) and then add it as a layer to the XYZ cloud? If that's
> not possible, what would be the easiest way to add the RGB image info to the
> XYZ cloud to get a XYZRGBA cloud? As I'm generating the cloud, how can I
> pack and add the RGB value for each point?
>
> Thanks for the help!
>
> --
> View this message in context: http://www.pcl-users.org/Drawing-planes-fitted-to-a-cloud-on-a-PPM-file-tp4019452p4019466.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Drawing planes fitted to a cloud on a PPM file

Blace
This post has NOT been accepted by the mailing list yet.
How is that done? I have the same problem.

Thanks in advance.


Radu B Rusu wrote
Are you saying that you have the information decoupled (maybe in 2 separate files)? If so, can't you create the XYZRGBA
cloud and add the RGB information to it yourself?

Cheers,
Radu.