Rolling shutter compensation
At this point, our video is stable, however, when objects in the scene are moving quickly, the rolling shutter effects become more pronounced.
To fix this, we'll need to do a few things. First, incorporate the rolling shutter speed into our calibration code. Second, when warping images, we need to unwarp the rolling shutter as well.
Calibrating the rolling shutter
To start calibrating the rolling shutter duration, we need to tweak the error function to incorporate another term. Let's start by looking at the calcErrorAcrossVideo
method. The part we're interested in is:
def calcErrorAcrossVideo(videoObj, theta, timestamp, focal_length, gyro_delay=None, gyro_drift=None, rolling_shutter=None): total_error = 0 ... transform = getAccumulatedRotation(...) transformed_corners = cv2.perspectiveTransform(old_corners, transform) ...
Also, we'll need to add logic to transform a corner based on its location—a corner in the upper part of the image is...