Unable to read pcd files using pcdread in matlab 2016a

33 views (last 30 days)
I get following error when I try to read pcd file using pcread (My system is matlab2016a, ubuntu 16.04, 64bit):
a=pcread('test.pcd');
Error using visionPlyRead
Ply file parsing error: Unable to read 'ply' from header.
Error in pcread (line 47)
properties = visionPlyRead(filename,elementName,requiredProperties,optionalProperties);
The pcd file is 0.7 format and has "COUNT" set to 1. The header of the pcd file is as below:
# .PCD v.7 - Point Cloud Data file format
VERSION .7
FIELDS x y z rgb
SIZE 4 4 4 4
TYPE F F F F
COUNT 1
WIDTH 213
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 213
DATA ascii
I have also tried clouds without RGB. The header is:
# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z
SIZE 4 4 4
TYPE F F F
COUNT 1(changed from 1 1 1)
WIDTH 12007
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 12007
DATA ascii
I got errors in both cases. The files dont have any "nan" values
  2 Comments
Jan
Jan on 18 May 2018
Edited: Jan on 18 May 2018
The message "Ply file parsing error: Unable to read 'ply' from header" is not useful. Can you attach the input file?
Bin Qi
Bin Qi on 26 Jan 2021
I have the same issue. Have you figured out the fix?

Sign in to comment.

Answers (1)

guojia guo
guojia guo on 14 Apr 2021
Well,it seems because of the low version of MATLAB,change it to 2018,pcread() can read both .pcd file and ply file.Another solution is using this function in MATLAB COMMUNITY,read .pcd file then using pointCloud() to make it .
pt=loadpcd('1.pcd');
ptCloud=pointCloud(pt');
pcwrite(ptCloud,'1.ply');%格式的转换

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!