Apply CLAHE to frames in add.py and compare.py

This commit is contained in:
Peter-Simon Dieterich 2019-11-01 11:53:17 +01:00
parent a051e41c06
commit 799628eddf
2 changed files with 7 additions and 0 deletions

View file

@ -139,12 +139,15 @@ 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
# Don't remove ret, it doesn't work without it
ret, frame = video_capture.read()
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])

View file

@ -172,6 +172,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
@ -197,6 +199,8 @@ while True:
print("\nUnknown camera, please check your 'device_path' config value.\n")
raise
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