Explore Library
Code QuizIntermediate

Rotate and Translate an Image

Find the mistake in building an affine warp that rotates and shifts an image.

Codepython
import cv2

def rotate(image, angle):
    h, w = image.shape[:2]
    center = (w / 2, h / 2)
    M = cv2.getRotationMatrix2D(center, angle, 1.0)
    # apply the transform
    return cv2.warpAffine(image, M, (h, w))

What is the bug in this rotate function?