How to load a off file into PCL ?

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

How to load a off file into PCL ?

lilouch
Hi,

I would like to process .off file (Object File Format) provided by Princeton Dataset.
I did not find a way to open point cloud into PCL and to convert them to another format like PLY or PCD.

Anyone faced this issue before ?

Thank you very much in advance,
Reply | Threaded
Open this post in threaded view
|

Re: How to load a off file into PCL ?

Chris Flesher
You might have to write your own converter. It seems like the OFF format is pretty simple, you can also write to PCD. Below is some example code of how to write a PCD file:

```
def writePCD(fileName, points):
    '''
    Generates a PCL point cloud file
   
    @param fileName (str): File name to write to
    @param points (np.array): Nx3 array of points
    '''
    points = np.atleast_2d(points)
    assert points.shape[1] == 3
    numPoints = points.shape[0]
    with open(fileName, 'w') as f:
        f.write('# .PCD v0.7 - Point Cloud Data file format\n')
        f.write('VERSION 0.7\n')
        f.write('FIELDS x y z\n')
        f.write('SIZE 4 4 4\n')
        f.write('TYPE F F F\n')
        f.write('COUNT 1 1 1\n')
        f.write('WIDTH %d\n' % numPoints)
        f.write('HEIGHT 1\n')
        f.write('VIEWPOINT 0 0 0 1 0 0 0\n')
        f.write('POINTS %d\n' % numPoints)
        f.write('DATA ascii\n')
        for k in xrange(numPoints):
            data = list(points[k])
            f.write('%f %f %f\n' % tuple([float(x) for x in data]))
```

On Tue, Jul 25, 2017 at 2:48 AM, lilouch <[hidden email]> wrote:
Hi,

I would like to process .off file (Object File Format) provided by Princeton
Dataset.
I did not find a way to open point cloud into PCL and to convert them to
another format like PLY or PCD.

Anyone faced this issue before ?

Thank you very much in advance,



--
View this message in context: http://www.pcl-users.org/How-to-load-a-off-file-into-PCL-tp4044848.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


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