start = time.time() for i in range(100): T.XYZ(beads, img) ts.append(time.time() - start) plt.plot(loopRange, np.array(ts), marker="o", label="GPU - Taichi") print(np.polynomial.polynomial.polyfit(loopRange[1:], ts[1:], 1)) if (True): ts = [] for loop in loopRange: beads = [] for i in range(loop): beads.append(N.Bead(50, 50)) N.XY(beads, img) for i in range(20): N.Calibrate(beads, [imgc[i]], i) N.ComputeCalibration(beads) N.XYZ(beads, img) print(beads[0]) start = time.time() for i in range(100): N.XYZ(beads, img) ts.append(time.time() - start) plt.plot(loopRange, np.array(ts), marker="o", label="CPU - Numpy") print(np.polynomial.polynomial.polyfit(loopRange[1:], ts[1:], 1))
circles = utils.HoughCircles(mm.Get(), 15, 30) # for c in circles: # if (c[0] > 80 and c[0] < 680 and c[1] > 80 and c[1] < 500): # beads.append(T.Bead(c[0], c[1])) beads = [ T.Bead(circles[0][0], circles[0][1]), T.Bead(circles[1][0], circles[1][1]) ] n = len(beads) print(n, "Beads:", beads) sz = mm.GetZ() T.XY(beads, mm.Get()) # calibrate imgc = [] for z in zcs: imgc.append([]) for t in range(3): for i in range(len(zcs)): z = zcs[i] mm.SetZ(z + sz) imgc[i].append(mm.Get()) for i in range(len(zcs)): z = zcs[i] T.Calibrate(beads, imgc[i], z + sz)