OpenCV provides two transformation functions,
cv2.warpAffine and cv2.warpPerspective,
with which you can have all kinds of transformations.
cv2.warpAffine takes a 2x3 transformation matrix
while cv2.warpPerspective takes a 3x3 transformation matrix as input.
Juri_001.jpg
lenna.jpg