# -*- coding: utf-8 -*-
"""
"""


import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
#from preproces_max import *

def rotateImage(image, angle):
  image_center = tuple(np.array(image.shape[:2])/2)
  rot_mat = cv2.getRotationMatrix2D(image_center,angle, 1.0)
  result = cv2.warpAffine(image, rot_mat, image.shape[:2],flags=cv2.INTER_LINEAR)
  return result



img_num = 102557

ang1 = 45
ang2 = 135

imgF = matplotlib.image.imread('images_test_rev1/'+str(img_num)+'.jpg')
img = imgF[100:300, 100:300]
img = cv2.resize(img, (100, 100))

img1 = rotateImage(img, ang1)
img2 = rotateImage(img, ang2)

plt.subplot(2,2,1), plt.imshow(imgF)
plt.title('Test Image')
plt.axis('off')

plt.subplot(2,2,2), plt.imshow(img)
plt.title('Cropped and Resized')
plt.axis('off')

plt.subplot(2,2,3), plt.imshow(img1)
plt.title('45 degree rotated')
plt.axis('off')


plt.subplot(2,2,4), plt.imshow(np.flipud(img))
plt.title('Flipped')
plt.axis('off')
plt.subplots_adjust(right=0.7)

#plt.tight_layout()