dnc253
dnc253

Reputation: 40337

PCL - Filtering out points not found in dense area

I have a point cloud of a subject, and then I construct a point cloud from all the points that lie within a specific plane. This point cloud looks something like this: enter image description here

I'm wanting to filter out all the extra points that aren't in that rectangle. When I get all the points for the plane, there are non-related points that just happen to be in the same plane. I'd like to filter those out, so I can work exclusively with the points in the rectangle.

I'm very new to working with point clouds and object modeling, so it's hard for me to know what I'm looking for. I tried using StatisticalOutlierRemoval, but (not-suprisingly) it doesn't always get all the extra points when those extra ones are a bit dense themselves. If I change the parameters to be more aggressive in the filtering, it starts removing points from the rectangle that I'm interested in.

I know there's a whole bunch of filters available, but I really don't know how they work or which one would be the best fit to solve this problem. I could go through each one with trial and error, but I'm hoping someone can point me in the right direction. Is there any way to get this end result I'm looking for?

Upvotes: 2

Views: 2541

Answers (3)

coderkb
coderkb

Reputation: 1

Is the point cloud organized? If yes, you can try using median filter? PCL provided it for only the z-dimension of the point cloud. You may need to modify your point cloud to get it filtered along the other dimensions(x,y) as well.

Upvotes: 0

stefan
stefan

Reputation: 3759

Like David I'd try the RadiusOutlierRemoval. Assuming your data is mostly 2 dimensional - Determine the density of your cloud within your rectangle (D in points/r²). The weakest point in your rectangle is a corner which has only D/4 neighbours (for a maximum radius not bigger than the shorter side). With a safety factor of X you could now filter all points with a density of less than D/(X*4) in their neighborhood. You start with a radius r that equals the shorter side of your rectangle and remove point with less than (D*r²)/(4*X) neighbours to get the bigger, farther outlier clusters. you repeat this process with decreasing radius to catch also smaller clusters nearer to your rectangle.

Upvotes: 1

David de la Iglesia
David de la Iglesia

Reputation: 2534

You could try:

  • Use the Radious Outlier Removal with the values of 'r' (setRadiusSearch) and 'k' (setMinNeighborsInRadius) based on the dimensions and density of your cloud. As rule of dumb, the higher those values, higher the chances to filter those points that you are interested in filtering.

  • Use the Pass Through Filter, if you know the coordinates of the points which you are actually interesting in, use those coordinates to build a "bounding box" with setFilterLimits and that way everithing outside the box will be filtered.

As you said that when you tried to change the parameters of the SOR filter, it started to remove points that you didn't want to be removed, probably the Pass Through Filter is your best bet.

Hope this help you.

Upvotes: 1

Related Questions