finger-sign-detection / utils /preprocess.py
arifa-batool's picture
Upload preprocess.py
f195438 verified
Raw
History Blame Contribute Delete
295 Bytes
import cv2
import numpy as np
IMG_SIZE = 64
def preprocess_image(image_path):
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (IMG_SIZE, IMG_SIZE))
img = img / 255.0
img = np.expand_dims(img, axis=0)
return img