From 514034d2c88e2921c91a5be923f2f17e3b357ef3 Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Sun, 5 Apr 2020 16:32:59 +0200 Subject: [PATCH] fix spot tracking --- process.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/process.py b/process.py index b206408..0b52404 100644 --- a/process.py +++ b/process.py @@ -50,7 +50,7 @@ def run(path): if ret == True: h, w, channels = frame.shape - smol = frame[int(h*0.5):int(h*0.9), int(w*0.58):int(w*0.8)] + smol = frame[int(h*0.5):int(h*0.9), int(w*0.55):int(w*0.8)] gray = cv2.cvtColor(smol, cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(gray, (7, 7), 0) thresh = cv2.threshold(blurred, 235, 255, cv2.THRESH_BINARY)[1] @@ -59,7 +59,7 @@ def run(path): for c in cnts: area = cv2.contourArea(c) - if area > 30 and area < 80: + if area > 28 and area < 80: # compute the center of the contour M = cv2.moments(c) cX = int(M["m10"] / M["m00"]) @@ -104,7 +104,7 @@ def run(path): turnedon = False spots = [spot for spot in spots if spot['lastseen'] > framenum - framerate] - spots.sort(key=lambda v: v['lastseen'], reverse=True) + spots.sort(key=lambda v: v['lifetime'], reverse=True) framenum += 1 if gui: