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

问题描述

我正在与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.

我在层格式的网格模型。当我加载模型与code:

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");

在第二种情况下,我想象的模型完全按照我做一个网格编辑器,但在第一种情况下我想象它的畸形版本,IE和球就像是和椭圆形。这是怎么回事?也许我应该手动品尝目?

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)

非常感谢你。

推荐答案

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

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);

此code打开PLY文件,并将其转换为点云以正确的形状。

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

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

06-30 03:29