Open DaniilSNikulin opened 4 years ago
CropHull<PointT>::filter ∈ Ω (n * m) CropBox<PointT>::filter ∈ O (n)
CropHull<PointT>::filter
CropBox<PointT>::filter
Where n - size of filtered point cloud, m - size of hull cloud. To find bounding box for CropBox need O (m) time.
n
m
CropBox
In my practical case using CropBox before CropHull significantly reduces runtime. So why not always use CropBox inside CropHull?
CropHull
This function is a template, which could be embed in CropHull.
template <class PointT> std::vector<int> filter(pcl::CropHull<PointT> & cropHullFilter, pcl::PointCloud<PointT>::ConstPtr bigCloudPtr, bool cropOutside = true) { // just because pcl::CropHull haven't got getCropOutside() function cropHullFilter.setCropOutside(cropOutside); // cropOutside = cropHullFilter.getCropOutside(); std::vector<int> cropInlierIndices; Eigen::Vector4f minPt, maxPt; pcl::getMinMax3D(*cropHullFilter.getHullCloud(), minPt, maxPt); pcl::CropBox<pcl::PointXYZ> cropBoxFilter(true); cropBoxFilter.setMin(minPt); cropBoxFilter.setMax(maxPt); cropBoxFilter.setInputCloud(bigCloudPtr); cropBoxFilter.filter(cropInlierIndices); pcl::PointCloud<PointT>::Ptr croppedCloudPtr(new pcl::PointCloud<PointT>); pcl::copyPointCloud(*rootCloudPtr, cropInlierIndices, *croppedCloudPtr); std::vector<int> filteredInlierIndices; cropHullFilter.setInputCloud(croppedCloudPtr); cropHullFilter.filter(filteredInlierIndices); std::vector<int> inlierIndices; if (!cropOutside) { for (int idx : cropBoxFilter.getRemovedIndices()) { inlierIndices.push_back(idx); } } for (int idx : filteredInlierIndices) { inlierIndices.push_back(cropInlierIndices[idx]); } return inlierIndices; }
Interesting suggestion and worth looking into.
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
CropHull<PointT>::filter
∈ Ω (n * m)CropBox<PointT>::filter
∈ O (n)Where
n
- size of filtered point cloud,m
- size of hull cloud. To find bounding box forCropBox
need O (m) time.In my practical case using
CropBox
beforeCropHull
significantly reduces runtime. So why not always useCropBox
insideCropHull
?This function is a template, which could be embed in
CropHull
.