pypcd icon indicating copy to clipboard operation
pypcd copied to clipboard

About count > 1

Open mxlnk opened this issue 4 years ago • 0 comments

Hi,

I'm currently trying to write a pcd file like this:

def make_xyz_label_layers_point_cloud(points, labels, layers):
    assert(len(points) == len(labels) and len(points) == len(layers))
    md = {'version': .7,
          'fields': ['x', 'y', 'z', 'label', 'layers'],
          'type': ['F', 'F', 'F', 'I', 'F'],
          'size': [4, 4, 4, 4, 4],
          'count': [1, 1, 1, 1, len(layers[0])],
          'width': len(points),
          'height': 1,
          'viewpoint': [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
          'points': len(points),
          'data': 'ASCII'}

    dt = np.dtype([('x', np.float32), ('y', np.float32), ('z', np.float32),
                   ('label', np.int32), ('layers', np.float32, (len(layers[0]),))]) # len(layers[0]) == 20
    pc_data = np.rec.fromarrays([points[:, 0], points[:, 1], points[:, 2],
                                 labels, layers], dtype=dt)

    pc = pypcd.PointCloud(md, pc_data)
    return pc

Writing this to ascii I get an error as the package tries to write it as 24 consecutive values but gets 4 consecutive values and an array with 20 values.

Do you happen to know if the format of wanting to write 24 consecutive values is correct (I think so)?

Am I using this right? If so would you be interested in a pull request fixing the saving problem?

mxlnk avatar Mar 02 '20 16:03 mxlnk