Ejemplo n.º 1
0
    def process(self, path, display=True):
        datadict = npy.read(path)
        # mah = MAHelper(datadict)
        # data_arrays = {}
        # for key in mah.arrays: data_arrays[key] = mah.D[key]
        clusters = None
        segment_graph = None
        if 'ma_clusters' in datadict:
            clusters = datadict['ma_clusters']
        if 'ma_segment_graph' in datadict:
            segment_graph = datadict['ma_segment_graph']

        coords = normals = colors = seg_link_flip = ma_segment_lidx = None
        if 'coords' in datadict:
            coords = datadict['coords']
        if 'normals' in datadict:
            normals = datadict['normals']
        if 'colors' in datadict:
            colors = datadict['colors']
        if 'seg_link_flip' in datadict:
            seg_link_flip = datadict['seg_link_flip'].astype(np.int32)
        if 'ma_segment_lidx' in datadict:
            ma_segment_lidx = datadict['ma_segment_lidx']

        return {
            'datadict': datadict,
            'coords': coords,
            'normals': normals,
            'colors': colors,
            'clusters': clusters,
            'segment_graph': segment_graph,
            'seg_link_flip': seg_link_flip,
            'ma_segment_lidx': ma_segment_lidx
        }
Ejemplo n.º 2
0
def main(args):
    keys = []
    if args.key:
        keys.append(args.key)
    datadict = npy.read(args.infile, keys)
    pcd.write(args.outfile, datadict, keys)
Ejemplo n.º 3
0
        '-m',
        '--mincount',
        help='Minimum edge count used during connected compenent analysis',
        default=20,
        type=int)
    parser.add_argument(
        '-d',
        '--highdegree',
        help='Remove the specified number of highest degree vertices',
        default=0,
        type=int)
    # parser.add_argument('-c', '--contract', help='contract edges', default=None, type=float)
    # parser.add_argument('-a', '--analyse', help='Also compute statistics for each sheet', dest='analyse', action='store_true')
    args = parser.parse_args()

    D = npy.read(args.infile)
    mah = MAHelper(D)

    # if not args.contract is None:
    #     contract_edges(mah.D['ma_segment_graph'], args.contract)
    clustering.get_clusters(mah, args.mincount, args.highdegree)
    # clustering.classify_clusters(mah)
    print("I found {} clusters".format(len(mah.D['ma_clusters'])))
    # for g in mah.D['ma_clusters']:
    #     if g['classification'] == 4: # building class
    #         clustering.analyse_cluster(mah, g)

    npy.write(args.infile, mah.D, ['ma_clusters'])

    # get ma_coords per cluster like:
    for cluster in mah.D['ma_clusters']:
Ejemplo n.º 4
0
def main(args):
	datadict = npy.read(args.infile)
	las.write(args.outfile,datadict)