Comments (6)
The example by @jspricke is wrong.
It should be:
bb_filter.setHullCloud(surface_hull);
As one should be using the points after the reconstruction.
from pcl.
Hi,
could you please provide a minimal test case, so we can reproduce thid?
Thanks
Jochen
from pcl.
// As a main cloud "cloud" 0000002.txt is used from KITTI Benchmark 2011_09_26_drive_0001
// available at http://www.cvlibs.net/datasets/kitti/raw_data.php
/* getBoundingBox(...)->points()
22.9035 7.80552 -1.79216
27.4452 7.61189 -1.79216
27.5215 9.40126 -1.79216
22.9798 9.59489 -1.79216
22.9035 7.80552 -1.79216 // Duplicate of row 1
22.9035 7.80552 0.483439
27.4452 7.61189 0.483439
27.5215 9.40126 0.483439
22.9798 9.59489 0.483439
22.9035 7.80552 0.483439 // Duplicate of row 6
*/
pcl::PointCloudpcl::PointXYZ::Ptr boundingbox_ptr, surface_hull (new pcl::PointCloudpcl::PointXYZ);
boundingbox_ptr = getBoundingBox(...);
pcl::ConvexHullpcl::PointXYZ hull;
hull.setInputCloud(boundingbox_ptr);
hull.setDimension(3);
std::vectorpcl::Vertices polygons;
hull.reconstruct(*surface_hull,polygons);
pcl::PointCloudpcl::PointXYZ::Ptr objects (new pcl::PointCloudpcl::PointXYZ);
pcl::CropHullpcl::PointXYZ bb_filter;
bb_filter.setDim(3);
bb_filter.setInputCloud(cloud);
bb_filter.setHullIndices(polygons);
bb_filter.setHullCloud(boundingbox_ptr);
bb_filter.filter(*objects);
from pcl.
Here is a minimal example:
#include <iostream>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/surface/convex_hull.h>
#include <pcl/filters/crop_hull.h>
int main()
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
cloud->push_back(pcl::PointXYZ(25.587, 7.8600001, 0.29100001));
cloud->push_back(pcl::PointXYZ(24.372999, 8.5909996, 0.28799999));
pcl::PointCloud<pcl::PointXYZ>::Ptr boundingbox_ptr (new pcl::PointCloud<pcl::PointXYZ>);
boundingbox_ptr->push_back(pcl::PointXYZ(22.9035, 7.80552, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(27.4452, 7.61189, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(27.5215, 9.40126, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9798, 9.59489, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9035, 7.80552, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(27.4452, 7.61189, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(27.5215, 9.40126, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9798, 9.59489, 0.483439));
pcl::ConvexHull<pcl::PointXYZ> hull;
hull.setInputCloud(boundingbox_ptr);
hull.setDimension(3);
std::vector<pcl::Vertices> polygons;
pcl::PointCloud<pcl::PointXYZ>::Ptr surface_hull (new pcl::PointCloud<pcl::PointXYZ>);
hull.reconstruct(*surface_hull, polygons);
for(int i = 0; i < polygons.size(); i++)
std::cout << polygons[i] << std::endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr objects (new pcl::PointCloud<pcl::PointXYZ>);
pcl::CropHull<pcl::PointXYZ> bb_filter;
bb_filter.setDim(3);
bb_filter.setInputCloud(cloud);
bb_filter.setHullIndices(polygons);
bb_filter.setHullCloud(boundingbox_ptr);
bb_filter.filter(*objects);
std::cout << objects->size() << std::endl;
boundingbox_ptr->clear();
objects->clear();
boundingbox_ptr->push_back(pcl::PointXYZ(22.9035, 7.80552, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(27.4452, 7.61189, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(27.5215, 9.40126, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9798, 9.59489, -1.79216));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9035, 7.80552, -1.79216)); // Duplicate of row 1
boundingbox_ptr->push_back(pcl::PointXYZ(22.9035, 7.80552, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(27.4452, 7.61189, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(27.5215, 9.40126, 0.483439));
boundingbox_ptr->push_back(pcl::PointXYZ(22.9798, 9.59489, 0.483439));
bb_filter.setHullCloud(boundingbox_ptr);
bb_filter.filter(*objects);
std::cout << objects->size() << std::endl;
}
Problem seems to be that the indices in polygons don't correspond to the ones in boundingbox_ptr.
from pcl.
Is there any follow up needed on this issue?
from pcl.
Closed due to lack of activity.
from pcl.
Related Issues (20)
- Is the gpu-accelerated VoxelGrid method unavailable in pcl 1.14.0 version? HOT 2
- [compile error] "PointXYZINormal not supported by visualization" HOT 1
- collect2: error: ld returned 1 exit status HOT 3
- error: ‘variate_generator’ is not a member of ‘std’ HOT 2
- error: texture is not a template HOT 2
- [Linker error] "Resolving Linker Errors when Using Custom Point Type with PCL's KdTree" HOT 1
- PCLVisualizer crash HOT 9
- Using PCL in QT Widget HOT 1
- [Cluster_Extraction] Trouble extracting clusters from Zivid pcd file HOT 2
- [request] PCL Concave hull & Convex hull HOT 6
- [SamplingSurfaceNormal]ERROR LNK2001 pcl::SamplingSurfaceNormal<struct pcl::PointXYZ>::applyFilter HOT 5
- [pcl_registration] ICP align broken in Release in new PCL version HOT 8
- [question] Corner detection Algorithm HOT 1
- [FastBilateralFilterOMP] FastBilateralFilterOMP does not support PointXYZI HOT 2
- [custom] error: macro "_mm512_srli_epi32" passed 3 arguments, but takes just 2 HOT 3
- There is a logic error in the code of the computeTransformation function in the gicp.hpp file when calculating the transformation matrix T HOT 5
- [convolution_3d.h] search :: the symbol on the left must be of a type HOT 4
- [visualize normal] Normals are displayed incorrectly HOT 19
- [=]] Provide a general summary of the issue HOT 1
- [custom] chatGPT code on pcl visualization : different behavior between pcl::visualization::PCLVisualizer::Ptr and pcl::visualization::PCLVisualizer HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pcl.