This commit is contained in:
Jordon Brooks 2023-08-17 01:57:53 +01:00
parent 3ea1568ad3
commit 7787d0584e
4 changed files with 35 additions and 25 deletions

View file

@ -54,11 +54,11 @@ def psnr(y_true, y_pred):
return 10.0 * K.log((max_pixel ** 2) / (K.mean(K.square(y_pred - y_true)))) / K.log(10.0)
def preprocess_frame(frame):
def preprocess_frame(frame, resize=True):
#Preprocesses a single frame, cropping it if needed
# Check frame dimensions and resize if necessary
if frame.shape[:2] != (HEIGHT, WIDTH):
if resize and frame.shape[:2] != (HEIGHT, WIDTH):
frame = cv2.resize(frame, (WIDTH, HEIGHT), interpolation=cv2.INTER_LINEAR)
# Scale frame to [0, 1]