# Reasonable: small rotation M = cv2.getRotationMatrix2D((cx, cy), 7, 1.0) rotated = cv2.warpAffine( img, M, (w, h), borderMode=cv2.BORDER_REPLICATE ) # Potentially problematic for a chest X-ray: flipped = img[:, ::-1]