mesh 2 point cloud

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

mesh 2 point cloud

zep
Hello,

For a project i have to convert a mesh object to a point cloud.
There are a couple of options in pcl, mesh2pcl and pcl_mesh_sampling.

Both are not working, the compiled versions or build it myself form source.
using obj and ply files.
i get an "Access violation reading ...". on line
 vis.renderViewTesselatedSphere (resolution, resolution, views_xyz, poses, enthropies, tesselated_sphere_level); for mesh2pcd
and ik get also an "Access violation reading ..." on line
 polydata->GetCellPoints (el, npts, ptIds); for pcl_mesh_sampling

The solution of mesh2pcl is the best for me.

can you help me with this.

system:

W7 64 bits
pcl 1.6.0 32 bits (All-in-one installers)
pcl 1.5.1 32 bits (All-in-one installers)

Reply | Threaded
Open this post in threaded view
|

Re: mesh 2 point cloud

aichim
Administrator
Hi,

You need to do:

PolygonMesh mesh;
/// do funky stuff with the mesh
PointCloud<PointXYZ / PointXYZRGB / etc. > cloud;
fromROSMsg (mesh.cloud, cloud).

You should have checked the contents of the PolygonMesh struct, and everything would have been clear :-)

Cheers,
Alex
---
http://www.openperception.org



On Mar 13, 2013, at 3:44 AM, zep <[hidden email]> wrote:

> Hello,
>
> For a project i have to convert a mesh object to a point cloud.
> There are a couple of options in pcl, mesh2pcl and pcl_mesh_sampling.
>
> Both are not working, the compiled versions or build it myself form source.
> using obj and ply files.
> i get an "Access violation reading ...". on line
> vis.renderViewTesselatedSphere (resolution, resolution, views_xyz, poses,
> enthropies, tesselated_sphere_level); for mesh2pcd
> and ik get also an "Access violation reading ..." on line
> polydata->GetCellPoints (el, npts, ptIds); for pcl_mesh_sampling
>
> The solution of mesh2pcl is the best for me.
>
> can you help me with this.
>
> system:
>
> W7 64 bits
> pcl 1.6.0 32 bits (All-in-one installers)
> pcl 1.5.1 32 bits (All-in-one installers)
>
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/mesh-2-point-cloud-tp4026721.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

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

Re: mesh 2 point cloud

zep
Hi,

thanks for your reaction

i tried it, but i got only the all the corners very triangle.
But i want really sub sample the mesh so i end up with around 100k points.
preferably only the outside of the mesh. so ray tracing form multiple views works for me, i think.

Zep

aichim wrote
Hi,

You need to do:

PolygonMesh mesh;
/// do funky stuff with the mesh
PointCloud<PointXYZ / PointXYZRGB / etc. > cloud;
fromROSMsg (mesh.cloud, cloud).

You should have checked the contents of the PolygonMesh struct, and everything would have been clear :-)

Cheers,
Alex
---
http://www.openperception.org



On Mar 13, 2013, at 3:44 AM, zep <[hidden email]> wrote:

> Hello,
>
> For a project i have to convert a mesh object to a point cloud.
> There are a couple of options in pcl, mesh2pcl and pcl_mesh_sampling.
>
> Both are not working, the compiled versions or build it myself form source.
> using obj and ply files.
> i get an "Access violation reading ...". on line
> vis.renderViewTesselatedSphere (resolution, resolution, views_xyz, poses,
> enthropies, tesselated_sphere_level); for mesh2pcd
> and ik get also an "Access violation reading ..." on line
> polydata->GetCellPoints (el, npts, ptIds); for pcl_mesh_sampling
>
> The solution of mesh2pcl is the best for me.
>
> can you help me with this.
>
> system:
>
> W7 64 bits
> pcl 1.6.0 32 bits (All-in-one installers)
> pcl 1.5.1 32 bits (All-in-one installers)
>
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/mesh-2-point-cloud-tp4026721.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

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

Re: mesh 2 point cloud

mustafaf
You can try the MeshQuadricDecimation from vtk. This lets you enter a decimation "percentage" and it will decimate that amount of triangles leaving you, the remaining triangles. You can then use the vertices of the triangles as the point cloud representation of the mesh (using the snippet Alex suggested).

boost::shared_ptr<pcl::PolygonMesh> original_mesh = %YOUR MESH%;
float decimatePercent = 30.0f;
boost::shared_ptr<pcl::PolygonMesh> decimated_mesh = boost::make_shared<pcl::PolygonMesh> ();
pcl::MeshQuadricDecimationVTK mesh_decimator;
mesh_decimator.setInputMesh(original_mesh);
float decimation_factor = decimatePercent/100.0f;
mesh_decimator.setTargetReductionFactor(decimation_factor);
mesh_decimator.process(*decimated_mesh);

boost::shared_ptr<pcl::PolygonMesh> vertices = boost::make_shared<pcl::PointCloud<pcl::PointXYZ>> ();
pcl::fromROSMsg(decimated_mesh->cloud, *vertices_cloud);
Reply | Threaded
Open this post in threaded view
|

Re: mesh 2 point cloud

Dinl
This post has NOT been accepted by the mailing list yet.
Mustafaf, are you sure this line works?:

boost::shared_ptr<pcl::PolygonMesh> vertices = boost::make_shared<pcl::PointCloud<pcl::PointXYZ>> ();