File size: 276 Bytes
b8b61aa |
1 2 3 4 5 6 7 8 |
import cv2
import numpy as np
from tensorflow.keras.preprocessing.image import img_to_array
def preprocess_frame(frame, target_size=(224, 224)):
frame = cv2.resize(frame, target_size)
frame = img_to_array(frame) / 255.0
return np.expand_dims(frame, axis=0) |