I am using scipy.interpolate.CubicSpline for basically interpolating between three frames, which I have to do for each pixel of the frame:
for x in range(input_img.shape[1]):
for y in range(input_img.shape[0]):
t = (t_frame_k_minus_1 + v, t_frame_k + y, t_frame_k_plus_1 + v_strich)
x_interpolated = CubicSpline(t, (u, x, u_strich))
y_interpolated = CubicSpline(t, (v, y, v_strich))
interpolation_results[pix_count, 0] = x_interpolated(t_frame_k_half_N)
interpolation_results[pix_count, 1] = y_interpolated(t_frame_k_half_N)
this takes approximately 12 min (I have an 1920 x 1080 frame). Now I want to now, is there a faster way for cubic spline interpolation? If you now an answer in MATLAB, I could use that too
In MATLAB you can use either
interp3orimresize3. I would suggest the second if you want interpolation in uniform time points.You can just do
Otherwise, with
interp3:Both of this should take significantly less than 12 minutes. The second one takes 0.316283 seconds in my PC for 1900x1080x3
frameswhere I makedesired_t_inx=[1.5,2.5], i.e. 2 frames.