import cv2
import numpy as np 

img = cv2.imread("./data/pup.jpg")

num_rows, num_cols = img.shape[:2]

translation_matrix = np.float32([[1,0,int(0.5*num_cols)], [0,1,int(0.5*num_rows)]])


img_translation = cv2.warpAffine(img, translation_matrix, (num_cols,num_rows))

rotation_matrix = cv2.getRotationMatrix2D((num_cols/2, num_rows/2), 45, 1)
img_rotation = cv2.warpAffine(img_translation, rotation_matrix, (num_cols, num_rows))

cv2.imshow("Rotation", img_rotation)
cv2.waitKey(0)