Getting the contour of cluster indices

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

Getting the contour of cluster indices

james
Administrator
Hi,

I have a bunch of clusters in the form of std::vector<pcl::PointIndices> cluster_indices;
I need to extract a second set of clusters to represent the contours of these primary clusters.
Is there a way to do this simply?

I see that pcl::PlanarRegion has a GetContour() member, but I do not know how I could generate a pcl::PlanarRegion from my cluster_indices, or if this is even a good method.

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

koen buys-2
On 19 July 2012 09:23, james <[hidden email]> wrote:
> Hi,
>
> I have a bunch of clusters in the form of std::vector<pcl::PointIndices>
> cluster_indices;
> I need to extract a second set of clusters to represent the contours of
> these primary clusters.
> Is there a way to do this simply?
>

How do you define the contour? in a 2D projection of the minimal hull
covering all the points?
Do you want to assume organised and projectable pointcloud?

> I see that pcl::PlanarRegion has a GetContour() member, but I do not know
> how I could generate a pcl::PlanarRegion from my cluster_indices, or if this
> is even a good method.
>
> Thanks,
> James
>
> --
> View this message in context: http://www.pcl-users.org/Getting-the-contour-of-cluster-indices-tp4020509.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: Getting the contour of cluster indices

james
Administrator
I am looking down on some simple objects, so I would define the contour as the 2D perimeter of the top visible surface, which makes up the clusters. These clouds are coming from an OpenNI device.
Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

Sergey
Administrator
Hi James,

I am not sure how you can identify the points in a cluster that belong to the top visible surface of the object. But assuming that you can do this, you may then fit a plane to this surface, project the identified points on it, and construct a convex hull which wraps them. (Use pcl::ProjectInliers and pcl::ConvexHull to do that.)

Cheers,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

jmanring
In reply to this post by james
Hi James,

james wrote
I need to extract a second set of clusters to represent the contours of these primary clusters.
I don't know if there is a simple way to do this in PCL, but I have a few ideas using the raw data. What you are basically wanting to do is edge detection for each cluster, right? If so, then you could just look for the outermost points in each cluster (perhaps using a kdtree would help here). Or you could take a window around the object, and then take the gradient of it. Edge points will be distinguished by high gradients, and you could pull them out by doing something as simple as thresholding. Just a few ideas.

jmanring
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

james
Administrator
In reply to this post by Sergey
Thanks for the input guys.
The good thing is that I already have the top surface segmented. The convex hull actually looks quite good for my purposes. I have a couple of questions regarding the convex hull (I will try it out anyway as well). For the reconstruct function described here http://docs.pointclouds.org/trunk/classpcl_1_1_convex_hull.html#ab9b739a5f9ccce436e520c6605fd641e what do the outputs "points" and "polygons" represent? Is it the edge only? Or all point bound within the edges? How exactly do both outputs differ?

Thanks very much,
James
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

Sergey
Administrator
James,

Both outputs are the same in 2D case, i.e. "polygons" actually contains only one polygon and the points inside are the same as in "points". These are the points that belong to the edge.

In 3D case you will get a "real" vector of polygons representing hull facets.

Regards,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Getting the contour of cluster indices

james
Administrator
Thanks Sergey, that makes sense, I appreciate your input.

Regards,
James