python-pcl icon indicating copy to clipboard operation
python-pcl copied to clipboard

Point cloud reading error. Failed to find match for field 'x'.

Open DmitrySavchuk opened this issue 5 years ago • 2 comments

Environment

OS: Ubuntu 16.04 PCL Version: 1.7.2 Cython Version: Cython 0.29.13
Python Version: 3.5.6

Context

I have point cloud in .las format. I converted it to the .pcd format with PDAL library sucessfuly. Then I tried to read this file as shown below. But I faced with incorrect behaviour. After that I tried to read table_scene_lms400.pcd file from examples. And everything went correct. So I made conclusion, that something is wrong with my .pcd file. But I can't get what it is exactly.

Code to Reproduce

First (in the shell): pdal translate cloud.las cloud.pcd

Then (in the Python shell): p = pcl.load('cloud.pcd')

Expected Behavior

I expected that point cloud file will be read

Current Behavior

I got a warning:

Failed to find match for field 'x'.
Failed to find match for field 'y'.
Failed to find match for field 'z'.

Point cloud object was created and even has the same number of points as the original one. But every point is just tuple with zeros (0.0, 0.0, 0.0).

Original file(binary data are missed):

VERSION 0.7 FIELDS x y z Intensity ReturnNumber NumberOfReturns ScanDirectionFlag EdgeOfFlightLine Classification ScanAngleRank UserData PointSourceId GpsTime Red Green Blue SIZE 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 TYPE F F F F F F F F F F F F F F F F COUNT 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WIDTH 4135341 HEIGHT 1 VIEWPOINT 0.0 0.0 0.0 1.0 0.0 0.0 0.0 POINTS 4135341 DATA binary

P.S. I tried to reduce the number of fields in the .pcd file. For example as here (binary data are missed):

VERSION 0.7
FIELDS X Y Z
SIZE 8 8 8
TYPE F F F
COUNT 1 1 1
WIDTH 5
HEIGHT 1
VIEWPOINT 0.0 0.0 0.0 1.0 0.0 0.0 0.0
POINTS 5
DATA binary

and here:

VERSION 0.7 FIELDS X Y Z Red Green Blue SIZE 8 8 8 8 8 8 TYPE F F F F F F COUNT 1 1 1 1 1 1 WIDTH 5 HEIGHT 1 VIEWPOINT 0.0 0.0 0.0 1.0 0.0 0.0 0.0 POINTS 5 DATA binary

But it didn't change anything.

Possible Solution

I think, that I need to somehow change my .pcd file, but can't figure out how. Or maybe I need to use another loading function? Can anyone help me?

DmitrySavchuk avatar Sep 11 '19 14:09 DmitrySavchuk

I have the same exact behavior over here. Any updates on this error?

1-I use pdal pipelines to convert a *.las to *.pcd. { "pipeline":[ "%INPUTSTRING%", { "type":"writers.pcd", "filename":"%OUTPUTSTRING%", "order":"x,y,z", "keep_unspecified":false } ] }""" 2-then in pcl, i receive following errors pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); if (pcl::io::loadPCDFile<pcl::PointXYZ>(testTrackB2SortedCroped, *cloud) == -1) { std::cout << "cloud reading failed" << std::endl; return(-1); }

the code successfully loads the pcd file into the *cloud variable but following lines appears in console :

Failed to find match for field 'x'. Failed to find match for field 'y'. Failed to find match for field 'z'.

edlabbe avatar Feb 15 '20 15:02 edlabbe

I know this ticket is quite old, but please see recent answer to the same issue at https://stackoverflow.com/a/64593667/1620549. Short answer is that PDAL currently stores XYZ as double precision, which is valid PCD, but there is no PCL type that can handle double precision. You can tell PDAL to convert to single precision instead.

chambbj avatar Oct 29 '20 15:10 chambbj