可视化网格与其点云之间的区别 [英] Difference between visualizing a mesh and its point cloud

查看:64
本文介绍了可视化网格与其点云之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PCL 和网格编辑器 (MeshLab).我有兴趣将我的网格导入 PCL 以进行一些 3D 处理.

I'm working with PCL and a Mesh editor (MeshLab). I'm interested in importing my meshes to PCL to do some 3D processing.

我有一个 ply 格式的网格模型.当我用代码加载模型时:

I've a mesh model in ply format. When I load the model with the code:

PointCloud<PointXYZRGBA>::Ptr cloud (new PointCloud<PointXYZRGBA> ()); 
pcl::io::loadPLYFile<pcl::PointXYZRGBA>(argv[1], *cloud); 

我把它想象成一个点云:

and I visualize it as a point cloud:

visualization::PCLVisualizer viewer ("Model"); 
viewer.addPointCloud (cloud,"model"); 

几何体不同于直接加载和可视化网格:

the geometry is different from loading and visualizing the mesh directly:

viewer.addModelFromPLYFile(argv[1], "model"); 

在第二种情况下,我完全像使用网格编辑器一样可视化模型,但在第一种情况下,我可视化了它的变形版本,即球体类似于椭圆体.这里发生了什么?也许我应该手动对网格进行采样?

In the second case, I visualize the model exactly as I do with a Mesh editor, but in the first case I visualize a deformed version of it, i.e and sphere is like and ellipsoid. What is happening here? Maybe I should manually sample the mesh?

如果我在查看器中添加两个模型,差异非常明显,点云比网格小,并且发生了一些奇怪的变形(请参阅附图)

If I add the two models in the viewer, the difference is very evident, the point cloud is smaller than the mesh, and it has suffered some strange deformation (please, see attached image)

非常感谢


(来源:pcl-users.org)子>

推荐答案

如果有人感兴趣,这里是答案:

If someone is interested, here's the answer:

PointCloud<PointXYZRGBA>::Ptr cloud (new PointCloud<PointXYZRGBA> ());
pcl::PolygonMesh triangles;
pcl::io::loadPolygonFilePLY(argv[1], triangles);
pcl::fromROSMsg(triangles.cloud, *cloud);

此代码打开一个 PLY 文件并将其转换为具有正确形状的点云.

This code opens a PLY file and converts it to a point cloud with the correct shape.

这篇关于可视化网格与其点云之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆