-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbasic_operations.py
More file actions
37 lines (27 loc) · 1 KB
/
basic_operations.py
File metadata and controls
37 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import numpy as np
import cv2
class BasicOperations():
def __init__(self, image):
super().__init__()
self.image = image
# rotate operations 90 - 180 - 270
def rotate_image_90(self):
new_image = cv2.rotate(self.image, cv2.cv2.ROTATE_90_CLOCKWISE)
return new_image
def rotate_image_180(self):
new_image = cv2.rotate(self.image, cv2.cv2.ROTATE_180)
return new_image
def rotate_image_270(self):
new_image = cv2.rotate(self.image, cv2.cv2.ROTATE_90_COUNTERCLOCKWISE)
return new_image
# flipping operations vertical - horizontal - vertical & horizontal
def flip_image_vertical(self):
new_image = cv2.flip(self.image, 0)
return new_image
def flip_image_horizontal(self):
new_image = cv2.flip(self.image, 1)
return new_image
def flip_image_horizontal_vertical(self):
new_image = cv2.flip(self.image, -1)
return new_image
# --- New Functions can be added under here ---#