当前位置:网站首页>pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
2022-07-06 08:22:00 【Will_Ye】
1. Problem
有一个pcd格式的点云文件,用pcd_viewer可以正常显示,但是想在meshlab里面做些编辑,发现无法打开,提示如下的错误
然后用vim
或gedit
来打开它,就会发现问题,有些点云文件很大,可能卡死在半路,但是我这个点云文件很小,用gedit test2.ply
,显示如下:可见,都是乱码的错误,所以可以推断,从pcd转成ply的过程处问题了。一般我们都是用
pcl_pcd2ply ./1650511200.015289296.pcd ./test2.ply
来转换pcd和ply,所以可以确定的是这个指令是没问题的,所以问题出在pcd文件那里。如果平时有留意导入pcd文件后,很多人都会做一个去除NAN值的操作,这一点其实很关键,因为在pcd文件里,确实会保存一些NAN值,而如果我们不先去除它们,直接转成ply文件,就会出现上述的情况,知道原因后,解决就简单了。
2. Solution
思路是:在pcd转ply前,先做一次去除NAN值操作,然后在进行转换,就没问题了。以下是实现代码:
int PCD2PLY_W_removeNAN(string pcdPath, string savePath)
pcl::PCLPointCloud2 cloud_ori;
if (loadPCDFile(pcdPath, cloud_ori) < 0)
{
cout << "Error: cannot load the PCD file!!!" << endl;
return -1;
}
// remove NaN type points
//依赖函数 #include <pcl/filters/filter.h>
std::vector<int> mapping;
pcl::removeNaNFromPointCloud(*cloud_ori, *cloud_ori, mapping);
string savePath = "/home/will/test1.ply";
pcl::PLYWriter writer;
writer.write(savePath,*cloud_ori);
return 0;
}
这时生成的test1.ply
就能在meshlab顺利打开了。
边栏推荐
- [2022 广东省赛M] 拉格朗日插值 (多元函数极值 分治NTT)
- JS select all and tab bar switching, simple comments
- Permutation and combination function
- Leetcode question brushing (5.31) string
- 在 uniapp 中使用阿里图标
- 远程存储访问授权
- vulnhub hackme: 1
- Résumé des diagrammes de description des broches de la série ESP
- Make learning pointer easier (3)
- 2022.02.13 - NC002. sort
猜你喜欢
Asia Pacific Financial Media | designer universe | Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers
Synchronized solves problems caused by sharing
Leetcode question brushing record | 203_ Remove linked list elements
C语言 - 位段
"Designer universe" APEC design +: the list of winners of the Paris Design Award in France was recently announced. The winners of "Changsha world center Damei mansion" were awarded by the national eco
Wincc7.5 download and installation tutorial (win10 system)
vulnhub hackme: 1
All the ArrayList knowledge you want to know is here
指针和数组笔试题解析
2022.02.13 - NC003. Design LRU cache structure
随机推荐
Online yaml to CSV tool
VMware 虚拟化集群
2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
Make learning pointer easier (3)
使用 BR 备份 TiDB 集群数据到兼容 S3 的存储
从 SQL 文件迁移数据到 TiDB
Zhong Xuegao, who cannot be melted, cannot escape the life cycle of online celebrity products
指针和数组笔试题解析
[brush questions] top101 must be brushed in the interview of niuke.com
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
LDAP應用篇(4)Jenkins接入
化不掉的钟薛高,逃不出网红产品的生命周期
[MySQL] database stored procedure and storage function clearance tutorial (full version)
【刷题】牛客网面试必刷TOP101
Analysis of pointer and array written test questions
Colorlog结合logging打印有颜色的日志
灰度升级 TiDB Operator
synchronized 解决共享带来的问题
将 NFT 设置为 ENS 个人资料头像的分步指南
从 TiDB 集群迁移数据至另一 TiDB 集群