You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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(np_type)
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
`
add a count to prevent repetition on dataframe
The text was updated successfully, but these errors were encountered:
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(np_type)
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
The text was updated successfully, but these errors were encountered: