np.array([[0, 1.5, 0], [ 1, 1.5, 0, ], [6, 1.5, 0]]), np.array([[0, 1.8, 0], [ 1, 1.8, 0, ], [6, 1.8, 0]]), np.array([[0, 0, 0], [2, 2, 0], [4, 4, 0]]) ] tracks = [t.astype(np.float32) for t in tracks] C = pf.larch_3split(tracks, None, 0.5) r = fos.ren() fos.add(r, fos.line(tracks, fos.red)) #fos.show(r) for c in C: color = np.random.rand(3) for i in C[c]['indices']: fos.add(r, fos.line(tracks[i] + np.array([8., 0., 0.]), color)) fos.add(r, fos.line(tracks[i] + np.array([16., 0., 0.]), color)) fos.add( r, fos.line(C[c]['rep3'] / C[c]['N'] + np.array([16., 0., 0.]), fos.white))
pass'pf.most_similar_track_zhang() T=pkl.load_pickle(fname) print 'Reducing the number of points...' T=[pf.approximate_ei_trajectory(t) for t in T] print 'Reducing further to tracks with 3 pts...' T2=[tm.downsample(t,3) for t in T] print 'LARCH ...' print 'Splitting ...' t=time.clock() C=pf.larch_3split(T2,None,5.) print time.clock()-t, len(C) for c in C: print c, C[c]['rep3']/C[c]['N'] r=show_rep3(C) print 'Merging ...' t=time.clock() C=merge(C,5.) print time.clock()-t, len(C) for c in C: print c, C[c]['rep3']/C[c]['N'] show_rep3(C,r,fos.red)
for c in C: pass # pf.most_similar_track_mam() T = pkl.load_pickle(fname) print 'Reducing the number of points...' T = [pf.approx_polygon_track(t) for t in T] print 'Reducing further to tracks with 3 pts...' T2 = [tm.downsample(t, 3) for t in T] print 'LARCH ...' print 'Splitting ...' t = time.clock() C = pf.larch_3split(T2, None, 5.) print time.clock() - t, len(C) for c in C: print c, C[c]['rep3'] / C[c]['N'] r = show_rep3(C) print 'Merging ...' t = time.clock() C = merge(C, 5.) print time.clock() - t, len(C) for c in C: print c, C[c]['rep3'] / C[c]['N']
np.array([[3,0,0],[3.5,1,0],[4,2,0]]), np.array([[3.2,0,0],[3.7,1,0],[4.4,2,0]]), np.array([[3.4,0,0],[3.9,1,0],[4.6,2,0]]), np.array([[0,0.2,0],[1,0.2,0],[2,0.2,0]]), np.array([[2,0.2,0],[1,0.2,0],[0,0.2,0]]), np.array([[0,0,0],[0,1,0],[0,2,0]]), np.array([[0.2,0,0],[0.2,1,0],[0.2,2,0]]), np.array([[-0.2,0,0],[-0.2,1,0],[-0.2,2,0]]), np.array([[0,1.5,0],[1,1.5,0,],[6,1.5,0]]), np.array([[0,1.8,0],[1,1.8,0,],[6,1.8,0]]), np.array([[0,0,0],[2,2,0],[4,4,0]])] tracks=[t.astype(np.float32) for t in tracks] C=pf.larch_3split(tracks,None,0.5) r=fos.ren() fos.add(r,fos.line(tracks,fos.red)) #fos.show(r) for c in C: color=np.random.rand(3) for i in C[c]['indices']: fos.add(r,fos.line(tracks[i]+np.array([8.,0.,0.]),color)) fos.add(r,fos.line(tracks[i]+np.array([16.,0.,0.]),color)) fos.add(r,fos.line(C[c]['rep3']/C[c]['N']+np.array([16.,0.,0.]),fos.white)) fos.show(r)