This commit is contained in:
Jordon Brooks 2023-08-16 22:45:16 +01:00
parent 54fa90247a
commit 15d8e57da5
4 changed files with 56 additions and 12 deletions

View file

@ -2,6 +2,11 @@
import cv2
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
from tensorflow.keras import backend as K
from globalVars import HEIGHT, NUM_PRESET_SPEEDS, WIDTH
@ -38,6 +43,10 @@ def extract_histogram_features(frame, bins=64):
return np.array(feature_vector)
def psnr(y_true, y_pred):
max_pixel = 1.0
return 10.0 * K.log((max_pixel ** 2) / (K.mean(K.square(y_pred - y_true)))) / K.log(10.0)
def preprocess_frame(frame, crf, speed):
# Check frame dimensions and resize if necessary