Skip to content

Instantly share code, notes, and snippets.

@Nithilaa
Created October 28, 2021 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nithilaa/6b8a334c59ff49f5d76f39d09b307555 to your computer and use it in GitHub Desktop.
Save Nithilaa/6b8a334c59ff49f5d76f39d09b307555 to your computer and use it in GitHub Desktop.
import numpy as np
rows, cols, ch = img.shape
src_points = np.float32([[0,0], [cols-1,0], [0,rows-1]])
dst_points = np.float32([[cols-1,0], [0,0], [cols-1,rows-1]])
matrix = cv2.getAffineTransform(src_points, dst_points)
img_afftran = cv2.warpAffine(img, matrix, (cols,rows))
cv2.imshow("Affine Transformation (Mirror)", img_afftran)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment