当前位置:网站首页>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顺利打开了。
边栏推荐
- CAD ARX 获取当前的视口设置
- [MySQL] lock
- Circular reference of ES6 module
- Hcip day 16
- [research materials] 2021 China online high growth white paper - Download attached
- "Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
- Ruffian Heng embedded bimonthly, issue 49
- Golang DNS write casually
- Huawei cloud OBS file upload and download tool class
- 化不掉的钟薛高,逃不出网红产品的生命周期
猜你喜欢
![[research materials] 2021 Research Report on China's smart medical industry - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] 2021 Research Report on China's smart medical industry - Download attached
![[MySQL] log](/img/e9/1617122888c096cf6aba2bdb88f0ef.png)
[MySQL] log

化不掉的钟薛高,逃不出网红产品的生命周期
![[brush questions] top101 must be brushed in the interview of niuke.com](/img/55/5ca957e65d48e19dbac8043e89e7d9.png)
[brush questions] top101 must be brushed in the interview of niuke.com

【MySQL】锁

【云原生】手把手教你搭建ferry开源工单系统

2022.02.13 - NC003. Design LRU cache structure

Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center

synchronized 解决共享带来的问题

Chinese Remainder Theorem (Sun Tzu theorem) principle and template code
随机推荐
升级 TiDB Operator
Use dumping to back up tidb cluster data to S3 compatible storage
Nft智能合约发行,盲盒,公开发售技术实战--合约篇
根据csv文件某一列字符串中某个数字排序
Understanding of law of large numbers and central limit theorem
Deep learning: derivation of shallow neural networks and deep neural networks
Configuring OSPF load sharing for Huawei devices
[research materials] 2022 China yuancosmos white paper - Download attached
备份与恢复 CR 介绍
2022.02.13 - NC004. Print number of loops
Leetcode skimming (5.29) hash table
Hill sort c language
CAD ARX 获取当前的视口设置
Upgrade tidb operator
hcip--mpls
Migrate data from SQL files to tidb
sys.argv
matplotlib. Widgets are easy to use
Summary of MySQL index failure scenarios
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund