CropHull in 3D

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CropHull in 3D

benoit duinat

pcl::PointCloud<pcl::PointXYZ>::Ptr inputCloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr hullCloud(new pcl::PointCloud<pcl::PointXYZ>());
std::vector<pcl::Vertices> vertices;
pcl::Vertices vt;

// inside point
inputCloud->push_back(pcl::PointXYZ(M_PI*0.3,M_PI*0.3,0));
// hull
hullCloud->push_back(pcl::PointXYZ(0,0,0));
hullCloud->push_back(pcl::PointXYZ(M_PI,0,0));
hullCloud->push_back(pcl::PointXYZ(M_PI,M_PI*0.5,0));
hullCloud->push_back(pcl::PointXYZ(0,M_PI*0.5,0));
hullCloud->push_back(pcl::PointXYZ(0,0,0));
// outside point
inputCloud->push_back(pcl::PointXYZ(-M_PI*0.3,-M_PI*0.3,0));

vt.vertices.push_back(1);
vt.vertices.push_back(2);
vt.vertices.push_back(3);
vt.vertices.push_back(4);
vt.vertices.push_back(5);
vertices.push_back(vt);

pcl::PointCloud<pcl::PointXYZ>::Ptr outputCloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::CropHull<pcl::PointXYZ> cropHull;
cropHull.setHullIndices(vertices);
cropHull.setInputCloud(inputCloud);
cropHull.setHullCloud(hullCloud);
cropHull.setDim(2);
cropHull.setCropOutside(false);

std::vector<int> indices;
cropHull.filter(indices);
cropHull.filter(*outputCloud);
--
Duinat Benoit
+14184736970

[hidden email]

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: CropHull in 3D

benoit duinat
I run the CropHull function work in 2D, but I can't make it work in 3D, with a box as hullCloud , and my own cloud point as an input.
Any exemples of 3D Crophull
Thanks

On Thu, Nov 2, 2017 at 11:07 AM, benoit duinat <[hidden email]> wrote:

pcl::PointCloud<pcl::PointXYZ>::Ptr inputCloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr hullCloud(new pcl::PointCloud<pcl::PointXYZ>());
std::vector<pcl::Vertices> vertices;
pcl::Vertices vt;

// inside point
inputCloud->push_back(pcl::PointXYZ(M_PI*0.3,M_PI*0.3,0));
// hull
hullCloud->push_back(pcl::PointXYZ(0,0,0));
hullCloud->push_back(pcl::PointXYZ(M_PI,0,0));
hullCloud->push_back(pcl::PointXYZ(M_PI,M_PI*0.5,0));
hullCloud->push_back(pcl::PointXYZ(0,M_PI*0.5,0));
hullCloud->push_back(pcl::PointXYZ(0,0,0));
// outside point
inputCloud->push_back(pcl::PointXYZ(-M_PI*0.3,-M_PI*0.3,0));

vt.vertices.push_back(1);
vt.vertices.push_back(2);
vt.vertices.push_back(3);
vt.vertices.push_back(4);
vt.vertices.push_back(5);
vertices.push_back(vt);

pcl::PointCloud<pcl::PointXYZ>::Ptr outputCloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::CropHull<pcl::PointXYZ> cropHull;
cropHull.setHullIndices(vertices);
cropHull.setInputCloud(inputCloud);
cropHull.setHullCloud(hullCloud);
cropHull.setDim(2);
cropHull.setCropOutside(false);

std::vector<int> indices;
cropHull.filter(indices);
cropHull.filter(*outputCloud);
--
Duinat Benoit
<a href="tel:(418)%20473-6970" value="+14184736970" target="_blank">+14184736970

[hidden email]



--
Duinat Benoit
+14184736970

[hidden email]

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users