Skip to content

Commit

Permalink
Create image.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jun 2, 2024
1 parent 205a639 commit 21758f8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/cosmic_pi_network/cvlib/image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import cv2
import numpy as np

class Image:
def __init__(self, path: str):
self.path = path
self.image = cv2.imread(path)

def resize(self, width: int, height: int) -> None:
self.image = cv2.resize(self.image, (width, height))

def convert_to_grayscale(self) -> None:
self.image = cv2.cvtColor(self.image, cv2.COLOR_BGR2GRAY)

def get_image(self) -> np.ndarray:
return self.image

0 comments on commit 21758f8

Please sign in to comment.