Describe the bug
When a pcd file get for exemple :
FIELDS x y z intensity ring
where _ are juste empty field who have a count number as below:
COUNT 1 1 1 4 1 1 10
To Reproduce
run Pyntcloud.from_file('path/to/file.pcd)
Expected behavior
error warning, "ValueError: field '__0000' occurs more than once"
Desktop (please complete the following information):
OS: ubuntu 18.04
Version master branch
Fix
`
def build_dtype(metadata):
""" build numpy structured array dtype from pcl metadata.
note that fields with count > 1 are 'flattened' by creating multiple
single-count fields.
TODO: allow 'proper' multi-count fields.
"""
fieldnames = []
typenames = []
count = 0
for f, c, t, s in zip(metadata['fields'],
metadata['count'],
metadata['type'],
metadata['size']):
np_type = pcd_type_to_numpy_type[(t, s)]
if c == 1:
fieldnames.append(f)
typenames.append(nptype)
else:
fieldnames.extend(['%s%04d' % (f, i + count) for i in range(c)])
count += c
typenames.extend([np_type] * c)
# This modify the fieldnames automatically generated who create an error
dtype = np.dtype(list(zip(fieldnames, typenames)))
return dtype
Describe the bug When a pcd file get for exemple : FIELDS x y z intensity ring where _ are juste empty field who have a count number as below: COUNT 1 1 1 4 1 1 10
To Reproduce run Pyntcloud.from_file('path/to/file.pcd)
Expected behavior error warning, "ValueError: field '__0000' occurs more than once"
Desktop (please complete the following information):
Fix ` def build_dtype(metadata): """ build numpy structured array dtype from pcl metadata. note that fields with count > 1 are 'flattened' by creating multiple single-count fields. TODO: allow 'proper' multi-count fields. """ fieldnames = [] typenames = [] count = 0 for f, c, t, s in zip(metadata['fields'], metadata['count'], metadata['type'], metadata['size']): np_type = pcd_type_to_numpy_type[(t, s)] if c == 1: fieldnames.append(f) typenames.append(nptype) else: fieldnames.extend(['%s%04d' % (f, i + count) for i in range(c)]) count += c typenames.extend([np_type] * c)
` add a count to prevent repetition on dataframe