Hacker News new | ask | show | jobs
by ur-whale 2118 days ago
Very, very nice, congratulations.

And it pretty much works out of the box, something rather unusual for researchy code.

What would make this absolutely great is there was a way to output a wavefront OBJ file for the dense 3D geometry.

1 comments

Never mind, it was easy: just add the following code at line 45 of demo.py:

    # Output .ply geometry for each face detected
    ocnt = 0
    for face in ver_lst:
        with open('face_%04d.ply' % ocnt, 'w') as f:
            x = face[0]
            y = face[1]
            z = face[2]
            n = x.size
            print('ply', file=f)
            print('format ascii 1.0', file=f)
            print('element vertex %d' % n, file=f)
            print('property float x', file=f)
            print('property float y', file=f)
            print('property float z', file=f)
            print('element face 0', file=f)
            print('property list uchar int vertex_indices', file=f)
            print('end_header', file=f)
            for i in range(0, n):
                print("%12.8f %12.8f %12.8f" % (x[i], y[i], z[i]), file=f)
            ocnt += 1
Thanks, I will consider adding it later :)