当前位置:网站首页>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顺利打开了。
边栏推荐
- [research materials] 2021 Research Report on China's smart medical industry - Download attached
- Sort according to a number in a string in a column of CSV file
- Leetcode question brushing (5.31) string
- Pointer advanced --- pointer array, array pointer
- "Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
- Colorlog结合logging打印有颜色的日志
- Online yaml to CSV tool
- Golang force buckle leetcode 1020 Number of enclaves
- 2022.02.13 - NC003. Design LRU cache structure
- [MySQL] database stored procedure and storage function clearance tutorial (full version)
猜你喜欢
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
指针进阶---指针数组,数组指针
【MySQL】鎖
2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
[MySQL] log
Fibonacci sequence
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
让学指针变得更简单(三)
Yyds dry goods inventory three JS source code interpretation eventdispatcher
Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
随机推荐
hcip--mpls
Restore backup data on S3 compatible storage with br
[luatos-air551g] 6.2 repair: restart caused by line drawing
1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero
Analysis of pointer and array written test questions
matplotlib. Widgets are easy to use
升级 TiDB Operator
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
[research materials] 2021 Research Report on China's smart medical industry - Download attached
Beijing invitation media
备份与恢复 CR 介绍
Asia Pacific Financial Media | female pattern ladyvision: forced the hotel to upgrade security. The drunk woman died in the guest room, and the hotel was sentenced not to pay compensation | APEC secur
Golang DNS 随便写写
LDAP应用篇(4)Jenkins接入
[research materials] 2022 enterprise wechat Ecosystem Research Report - Download attached
All the ArrayList knowledge you want to know is here
Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development
Use dumping to back up tidb cluster data to S3 compatible storage
CAD ARX 获取当前的视口设置
Mobile Test Engineer occupation yyds dry goods inventory