当前位置:网站首页>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 gets the current viewport settings
- Chinese Remainder Theorem (Sun Tzu theorem) principle and template code
- ESP系列引脚说明图汇总
- [research materials] 2022 China yuancosmos white paper - Download attached
- Permutation and combination function
- 2. File operation - write
- IoT -- 解读物联网四层架构
- 3. File operation 3-with
- Introduction to number theory (greatest common divisor, prime sieve, inverse element)
- Migrate data from SQL files to tidb
猜你喜欢

在 uniapp 中使用阿里图标

IOT -- interpreting the four tier architecture of the Internet of things

"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

Golang DNS write casually

Hcip day 16

leetcode刷题 (5.28) 哈希表

From monomer structure to microservice architecture, introduction to microservices

Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development

2022 Inner Mongolia latest construction tower crane (construction special operation) simulation examination question bank and answers
![[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes](/img/ac/773ce8ee7f380df19edf8373250608.jpg)
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes
随机推荐
[MySQL] log
Let the bullets fly for a while
Learn Arduino with examples
Step by step guide to setting NFT as an ens profile Avatar
IP lab, the first weekly recheck
Nft智能合约发行,盲盒,公开发售技术实战--合约篇
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
vulnhub hackme: 1
Leetcode question brushing (5.28) hash table
Asia Pacific Financial Media | "APEC industry +" Western Silicon Valley invests 2trillion yuan in Chengdu Chongqing economic circle to catch up with Shanghai | stable strategy industry fund observatio
[brush questions] top101 must be brushed in the interview of niuke.com
Vocabulary notes for postgraduate entrance examination (3)
Online yaml to CSV tool
JVM performance tuning and practical basic theory - Part 1
Huawei cloud OBS file upload and download tool class
The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
2022.02.13 - NC003. Design LRU cache structure
Modify the video name from the name mapping relationship in the table
Colorlog结合logging打印有颜色的日志
1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero