Merge pull request #276 from PetePriority/patch-ir-detect

Apply CLAHE to frames in add.py and compare.py
This commit is contained in:
boltgolt 2019-11-09 11:25:10 +01:00 committed by GitHub
commit bf4a129f22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -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])

View file

@ -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