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
Get filtered out point cloud
Re: Get filtered out point cloud
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
https://github.com/CloudCompare/CloudCo ... .cpp#L5225
Daniel, CloudCompare admin
Re: Get filtered out point cloud
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
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
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).
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
Re: Get filtered out point cloud
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.
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.