Ejemplo n.º 1
0
def main():
    # read points and normals from a ply file
    datadict = io_ply.read_ply('example-data/house_dyke_tree.ply')
    
    # compute interior and exterior MAT
    ma = MASB(datadict, 10)
    ma.compute_balls()

    # write MA points to file
    io_npy.write_npy('house_dyke_tree_npy', datadict)
Ejemplo n.º 2
0
def main():
    # read points and normals from a ply file
    datadict = io_ply.read_ply('example-data/house_dyke_tree.ply')

    # compute interior and exterior MAT
    ma = MASB(datadict, 10)
    ma.compute_balls()

    # write MA points to file
    io_npy.write_npy('house_dyke_tree_npy', datadict)
Ejemplo n.º 3
0
def main(args):
    if args.infile.endswith('ply'):
        datadict = io_ply.read_ply(args.infile)
    elif args.infile.endswith('npy'):
        if args.ma:
            datadict = io_npy.read_npy(args.infile, ['coords', 'normals'])
        else:
            datadict = io_npy.read_npy(args.infile, ['coords', 'ma_coords_in', 'ma_coords_out'])
    
    # compute interior and exterior MAT
    if args.ma:
        ma = MASB(datadict, args.radius, denoise=args.denoise, detect_planar=args.planar)
        ma.compute_balls()

    if args.lfs or not args.ma:
        metacompute.compute_lfs(datadict)

    io_npy.write_npy(args.outfile, datadict)
Ejemplo n.º 4
0
def main(args):
    if args.infile.endswith('ply'):
        datadict = io_ply.read_ply(args.infile)
    elif args.infile.endswith('npy'):
        if args.ma:
            datadict = io_npy.read_npy(args.infile, ['coords', 'normals'])
        else:
            datadict = io_npy.read_npy(
                args.infile, ['coords', 'ma_coords_in', 'ma_coords_out'])

    # compute interior and exterior MAT
    if args.ma:
        ma = MASB(datadict,
                  args.radius,
                  denoise=args.denoise,
                  detect_planar=args.planar)
        ma.compute_balls()

    if args.lfs or not args.ma:
        metacompute.compute_lfs(datadict)

    io_npy.write_npy(args.outfile, datadict)
Ejemplo n.º 5
0
def main(args):
	if args.infile.endswith('ply'):
		from masbpy import io_ply
		datadict = io_ply.read_ply(args.infile)
	elif args.infile.endswith('las'):
		from masbpy import io_las
		datadict = io_las.read_las(args.infile)
	elif args.infile.endswith('npy'):
		datadict = io_npy.read_npy(args.infile, ['coords'])
	
	kd_tree = KDTree( datadict['coords'] )
	neighbours = kd_tree.query( datadict['coords'], args.k+1 )[1]
	neighbours = datadict['coords'][neighbours]
	
	p = Pool()
	t1 = time()
	normals = p.map(compute_normal, neighbours)
	t2 = time()
	print "finished normal computation in {} s".format(t2-t1)
	
	datadict['normals'] = np.array(normals, dtype=np.float32)

	io_npy.write_npy(args.outfile, datadict)
Ejemplo n.º 6
0
def main(args):
    if args.infile.endswith('ply'):
        from masbpy import io_ply
        datadict = io_ply.read_ply(args.infile)
    elif args.infile.endswith('las'):
        from masbpy import io_las
        datadict = io_las.read_las(args.infile)
    elif args.infile.endswith('npy'):
        datadict = io_npy.read_npy(args.infile, ['coords'])

    kd_tree = KDTree(datadict['coords'])
    neighbours = kd_tree.query(datadict['coords'], args.k + 1)[1]
    neighbours = datadict['coords'][neighbours]

    p = Pool()
    t1 = time()
    normals = p.map(compute_normal, neighbours)
    t2 = time()
    print "finished normal computation in {} s".format(t2 - t1)

    datadict['normals'] = np.array(normals, dtype=np.float32)

    io_npy.write_npy(args.outfile, datadict)
Ejemplo n.º 7
0
def calcEt(original_data):
    point_kd_tree = KDTree(original_data['coords'])

    vertices = pd.read_pickle('./tmp/burned-vertices.pickle')

    def getRadii(row):
        index = row['index']

        if index % 500 == 0:
            print 'et:', index

        here = row.values[:3].reshape([1, 3]).astype(np.float32)
        neighbor, idx = point_kd_tree.query(here, k=3)

        radii = np.linalg.norm(here - neighbor)

        return radii

    def getEt(row):
        return row['time'] - row['radii']

    vertices.loc[:, 'radii'] = vertices.apply(getRadii, axis=1)
    vertices.loc[:, 'et'] = vertices.apply(getEt, axis=1)

    vertices.to_pickle('./tmp/et-vertices.pickle')


if __name__ == '__main__':
    original_data = io_ply.read_ply(sys.argv[1])
    calcEt(original_data)
Ejemplo n.º 8
0
def main():
    datadict = io_ply.read_ply(sys.argv[1])
    original_data = io_ply.read_ply(sys.argv[2])

    generateGraph(datadict, original_data)