Page 1 of 1
Get filtered out point cloud
Posted: Tue Jun 18, 2019 3:52 pm
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
Re: Get filtered out point cloud
Posted: Tue Jun 18, 2019 5:19 pm
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
Re: Get filtered out point cloud
Posted: Wed Jun 19, 2019 1:55 pm
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
Re: Get filtered out point cloud
Posted: Wed Jun 19, 2019 5:48 pm
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).
Re: Get filtered out point cloud
Posted: Wed Jun 26, 2019 12:36 pm
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.