def process_data(r0): r0 = lm.shuffle_points(r0) ### CPD registration rtemp0, n, i = lm.get_shape_with_most_points(r0) r1 = lm.register_cpd(r0, rtemp0) ### reorder points: r2 = lm.reorder_points(r1, optimum_order=True, ensure_clockwise=True) ### correspondence: rtemp1 = r2[i] r3 = lm.set_npoints(r2, n) r4 = lm.corresp_roll(r3, rtemp1) return r4, rtemp1
'Bell', 'Comma', 'Device8', 'Face', 'Flatfish', 'Hammer', 'Heart', 'Horseshoe', 'Key' ] name = names[0] fnameCSV = os.path.join(dirREPO, 'Data', name, 'contours_sroc.csv') r = lm.read_csv(fnameCSV) i0, i1 = 1, 2 r0, r1 = r[i0], r[i1] #(1) Process: np.random.seed(0) ### shuffle: rA0, rA1 = lm.shuffle_points(r0), lm.shuffle_points(r1) ### reorder: rB0, rB1 = [ lm.reorder_points(r, optimum_order=True, ensure_clockwise=True) for r in [rA0, rA1] ] ### optimum roll correspondence: rD0 = rB0.copy() rD1 = lm.corresp_roll(rB1, rB0) ### intermediary roll: rC0 = rB0.copy() rC1 = np.roll(rB1, 75, axis=0) #(1) Plot: plt.close('all') lm.set_matplotlib_rcparams() fig = plt.figure(figsize=(10, 3)) # create axes: axw, axh = 0.25, 0.95