Size field of pcd format

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Size field of pcd format

Jack14
Hi!

I have a pcd file that has been generated by an external Project. I believe
they do not use any pcl Code to write this file. Here is a snippet:

VERSION .7
FIELDS x y z
SIZE 8 8 8
TYPE F F F
COUNT 1 1 1
WIDTH 512
HEIGHT 424
VIEWPOINT 0.4628057 2.643565 3.475626 0.7346018 0.1551246 0.6462753
-0.1364728
POINTS 217088
DATA ascii
2.123468 0.005027056 5.678125
2.131507 0.004250765 5.685073
2.138686 0.004897594 5.690863
...

Interestingly, I can read this file with Matlab 2017a, but I can't display
it with pcd_viewer on my Windows computer (1.6.0) nor with the PCL shipped
with ROS Kinetic (I believe that is 1.7.2). If I change the size field to "4
4 4", I can display it with all the mentioned tools. Matlab then says that
the points are of type "single" instead of "double" and the values differ
very slightly.

1. What is up with this size field? Has this somehow changed in PCL
versions? (I was told that the pcd is readable with
http://www.pointclouds.org/assets/viewer/pcl_viewer.html for example)
2. Can I safely change 8 8 8 to 4 4 4? Will this break something in newer
pcl versions? Will this cause any severe precision problems?

Thanks!
Jack



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Size field of pcd format

Hilarius
As defined by the PCD file format documentation, size defines the number
of bytes per entry in the dataset.

http://pointclouds.org/documentation/tutorials/pcd_file_format.php

unsigned int/int/float has 4 bytes
double has 8 bytes

Most of pcl algorithms, if not all, use float as a datatype therefore
anything else is kind of strange or unexpected to me. So I guess you are
right, that is has been generated from a different application.

The precision of the data type can be of danger if processing the data
in a specific way or if you need to store big values with high
precision. As most people work with data in mm or meter and coordinates
systems are local and precise or significant to the 4th digit, float is
enough for most calculations. If your dataset is based on a national or
global reference frame, then you can have problems.

Felix


Am 29.09.2017 um 13:03 schrieb Jack14:

> Hi!
>
> I have a pcd file that has been generated by an external Project. I believe
> they do not use any pcl Code to write this file. Here is a snippet:
>
> VERSION .7
> FIELDS x y z
> SIZE 8 8 8
> TYPE F F F
> COUNT 1 1 1
> WIDTH 512
> HEIGHT 424
> VIEWPOINT 0.4628057 2.643565 3.475626 0.7346018 0.1551246 0.6462753
> -0.1364728
> POINTS 217088
> DATA ascii
> 2.123468 0.005027056 5.678125
> 2.131507 0.004250765 5.685073
> 2.138686 0.004897594 5.690863
> ...
>
> Interestingly, I can read this file with Matlab 2017a, but I can't display
> it with pcd_viewer on my Windows computer (1.6.0) nor with the PCL shipped
> with ROS Kinetic (I believe that is 1.7.2). If I change the size field to "4
> 4 4", I can display it with all the mentioned tools. Matlab then says that
> the points are of type "single" instead of "double" and the values differ
> very slightly.
>
> 1. What is up with this size field? Has this somehow changed in PCL
> versions? (I was told that the pcd is readable with
> http://www.pointclouds.org/assets/viewer/pcl_viewer.html for example)
> 2. Can I safely change 8 8 8 to 4 4 4? Will this break something in newer
> pcl versions? Will this cause any severe precision problems?
>
> Thanks!
> Jack
>
>
>
> --
> Sent from: http://www.pcl-users.org/
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Size field of pcd format

icedoggy
In reply to this post by Jack14
Hi!
yes, you are right. As you had expected the file was most likely written
with Matlab. I have had the same problem when reading data from LAS files,
written as double not float and also when reading PCD files written with
Matlab. See this threat for details:
http://www.pcl-users.org/Artifacts-when-converting-point-clouds-from-double-to-float-td4044571.html

What you also can do is not to use the internal Matlab routines to save pcd
files but use this little toolbox here:
https://de.mathworks.com/matlabcentral/fileexchange/40382-matlab-to-point-cloud-library

Here you can specify different types but you might have to cast your data
before. Also you may loose some or lots of precision when converting from
double to single as I have described in the mentioned thread above.





--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users