diff --git a/src/cli/add.py b/src/cli/add.py index a345037..cd1f12c 100644 --- a/src/cli/add.py +++ b/src/cli/add.py @@ -108,9 +108,14 @@ enc = [] frames = 0 dark_threshold = config.getfloat("video", "dark_threshold") +clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8)) + # Loop through frames till we hit a timeout while frames < 60: + # Grab a single frame of video frame, gsframe = video_capture.read_frame() + gsframe = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + gsframe = clahe.apply(gsframe) # Create a histogram of the image with 8 values hist = cv2.calcHist([gsframe], [0], None, [8], [0, 256]) diff --git a/src/compare.py b/src/compare.py index 8f8dfbf..5679877 100644 --- a/src/compare.py +++ b/src/compare.py @@ -137,6 +137,8 @@ end_report = config.getboolean("debug", "end_report") frames = 0 timings["fr"] = time.time() +clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8)) + while True: # Increment the frame count every loop frames += 1 @@ -148,6 +150,8 @@ while True: # Grab a single frame of video frame, gsframe = video_capture.read_frame() + gsframe = clahe.apply(gsframe) + # Create a histogram of the image with 8 values hist = cv2.calcHist([gsframe], [0], None, [8], [0, 256]) # All values combined for percentage calculation