Get filtered out point cloud

Feel free to ask any question here
Post Reply
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Get filtered out point cloud

Post by fblue »

Hi,
In my program I apply the method SOR filtering to clean a point cloud and I can get a filtered-in point cloud by:

"CCLib::ReferenceCloud* selection = CCLib::CloudSamplingTools::sorFilter(cloud,s_sorFilterKnn,s_sorFilterNSigma,0,&pDlg);
ccPointCloud* cleanCloud = cloud->partialClone(selection);"

How to get the filtered-out points as a ccPointCloud object?

thanks
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Get filtered out point cloud

Post by daniel »

You can create a new cloud from the input cloud and the subset (ReferenceCloud). See the 'partialClone' method, and how it's used here for instance:
https://github.com/CloudCompare/CloudCo ... .cpp#L5225
Daniel, CloudCompare admin
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: Get filtered out point cloud

Post by fblue »

I'm not sure if it's the idea:
The reference cloud "selection" stores the indexs of filtered-in points of the input point cloud. So I need to create a new reference cloud "filtered_out" to store the indexs of the filtered-out points, then use patialClone() to get a ccPointCloud.

How to create a subset to get the "filtered_out" reference cloud ? By comparing if the index of one point in input cloud is not in the reference cloud "selection"?

Thanks
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Get filtered out point cloud

Post by daniel »

Oh sorry, I missed the trick in your question ;)

Yes you would need to create the inverse selection (ReferenceCloud) indeed. If you are not too concerned by the memory, the fastest solution would be to create a vector of booleans (as many as the total number of points, all set to false for instance). Fill it based on the filtered-in indexes (with 'true's'). Then parse it to create the negative version.

There's no built-in method, apart from the 'visibility' array on the point cloud (which is basically the same principle) that then let you create both clouds at the same time as it splits the cloud into two parts (inside and outside - see createNewCloudFromVisibilitySelection).
Daniel, CloudCompare admin
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: Get filtered out point cloud

Post by fblue »

Thank you so much! :-)
As you said, I need to create a vector of boolean for each point and then apply ccGenericPointCloud::getTheVisiblePoints(vistable, false) to get the selection.
Post Reply