Skip to content

Instantly share code, notes, and snippets.

@taldehyde
Created September 24, 2014 04:55
Show Gist options
  • Save taldehyde/78f9688a0357b092cc0c to your computer and use it in GitHub Desktop.
Save taldehyde/78f9688a0357b092cc0c to your computer and use it in GitHub Desktop.
import numpy as np
import cv2
img = cv2.imread("lena.bmp",0)
upsideDown = np.zeros((512,512),dtype=np.uint8)
mirror = np.zeros((512,512),dtype=np.uint8)
diagonal = np.zeros((512,512),dtype=np.uint8)
for i in xrange(512):
for j in xrange(512):
upsideDown[i][j] = img[511-i][j]
mirror[i][j] = img[i][511-j]
diagonal[i][j] = img[j][i]
cv2.imwrite("lena_1.bmp",upsideDown)
cv2.imwrite("lena_2.bmp",mirror)
cv2.imwrite("lena_3.bmp",diagonal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment