diff --git a/utils.py b/utils.py index fc9f457..47e61e7 100644 --- a/utils.py +++ b/utils.py @@ -1,4 +1,5 @@ from astropy.io.fits import open +import cv2 import numpy as np global_i = 0 @@ -202,3 +203,11 @@ def last_consecutive( list_ ): else: # if inside the consecutive list and last element, every element is consecutive break return i +def rotate( image , angle ): + """ + rotate the following image by the given angle + """ + height , width = image.shape[ : 2 ] + cX , cY = ( width // 2 , height // 2 ) + matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 ) + return cv2.warpAffine( image , matrix , ( width , height ) , flags = cv2.INTER_LINEAR )