In [ ]:
# Zoom values for Video frames
This was a test to find a polynomial which generates good zoom values for video frames.
In [32]:
import numpy as np
import matplotlib.pyplot as plt
import numpy.polynomial.polynomial as poly
In [33]:
zoom_range = np.arange(1, 1250)
x = np.array([1, 10, 100, 250, 500, 750, 1000])
y = np.array([1, 2, 10, 100, 500, 30000, 250000])
coefs = poly.polyfit(x, y, 6)
#print(coefs)
print(poly.polyval(1000, coefs))
ffit = poly.polyval(zoom_range, coefs)
#plt.plot(zoom_range, ffit)
#plt.plot(x, y, 'bo')
#plt.show()
In [34]:
fig = plt.figure(1)
ax_1 = fig.add_subplot(211)
ax_1.plot(zoom_range, np.log(zoom_range)**2, 'r', label="x^2")
ax_1.set_yscale('log')
ax_1.legend()
ax_2 = fig.add_subplot(212)
ax_2.plot(zoom_range, zoom_range**2 / 20, 'b', label="x^3")
ax_2.set_yscale('log')
ax_2.legend()
plt.show()
In [ ]: