I sometimes observed a frame-flipping issue when using vid.stab with ffmpeg, i.e. the video would turn upside-down and then back to normal again.
After some investigation, I found out that the reason was that the rotation angle that was found in the gradient descent procedure (within vsMotionsToTransform) was around 2 pi for a frame. Then, during the averaging process in cameraPathGaussian, a transformation of a frame with an angle of ca. 0 rad was averaged with an angle of ca. 2 pi, resulting in an angle of ca. pi, i.e., a flip. (In reality, of course, the averaging is more complicated as there are more terms with different weights).
I found that restricting the angle to values from -pi to pi in new_transform fixes that problem.
Hi,
I sometimes observed a frame-flipping issue when using vid.stab with ffmpeg, i.e. the video would turn upside-down and then back to normal again. After some investigation, I found out that the reason was that the rotation angle that was found in the gradient descent procedure (within
vsMotionsToTransform
) was around 2 pi for a frame. Then, during the averaging process incameraPathGaussian
, a transformation of a frame with an angle of ca. 0 rad was averaged with an angle of ca. 2 pi, resulting in an angle of ca. pi, i.e., a flip. (In reality, of course, the averaging is more complicated as there are more terms with different weights).I found that restricting the angle to values from -pi to pi in
new_transform
fixes that problem.Regards, Gernot