def labSliceAnimation(): fig = plt.figure() fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.9, wspace=0.1, hspace=0.2) font_size = 15 fig.suptitle("Lab slice (Animation)", fontsize=font_size) plt.subplot(1, 2, 1) plt.title("OpenCV Lab2rgb", fontsize=font_size) lab_plot_cv = LabSlicePlot(LabSlice(func=Lab2rgb_cv)) plt.subplot(1, 2, 2) plt.title("Implemented Lab2rgb", fontsize=font_size) lab_plot_py = LabSlicePlot(LabSlice(func=Lab2rgb_py)) def animFunc(step, *args): plots = lab_plot_cv.animationFunc(step) plots.extend(lab_plot_py.animationFunc(step)) plt.draw() return plots ani = animation.FuncAnimation(fig, animFunc, interval=0, blit=True) showMaximize()
def colorTransferAnimation(): fig = plt.figure() fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.9, wspace=0.1, hspace=0.2) font_size = 15 fig.suptitle("Color Transfer (Animation)", fontsize=font_size) ab_original = [(-10, -20), (-20, 10), (40, 20)] ab_edited = [(30, -50), (10, 30), (60, -20)] abs_points = [(0, 0), (-20, 10), (0, -30), (-20, 10), (-20, 20), (40, 20), (40, -10)] abs_animation = resample(abs_points, num=100) transfer_plot = ABTransferPlot(ab_original, ab_edited, abs_animation=abs_animation) ani = animation.FuncAnimation(fig, transfer_plot.animationFunc, interval=10, blit=True) showMaximize()