diff --git a/process.py b/process.py index 7d36fa7..b206408 100644 --- a/process.py +++ b/process.py @@ -49,17 +49,17 @@ def run(path): ret, frame = cap.read() if ret == True: h, w, channels = frame.shape - frame = frame[int(h*0.5):int(h*0.9), int(w*0.62):int(w*0.8)] - gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) - blurred = cv2.GaussianBlur(gray, (5, 5), 0) + smol = frame[int(h*0.5):int(h*0.9), int(w*0.58):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] cnts = cv2.findContours(thresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)[-2] for c in cnts: area = cv2.contourArea(c) - if area > 30 and area < 60: + if area > 30 and area < 80: # compute the center of the contour M = cv2.moments(c) cX = int(M["m10"] / M["m00"]) @@ -108,7 +108,8 @@ def run(path): framenum += 1 if gui: - cv2.imshow('frame',frame) + cv2.imshow('frame',blurred) + #cv2.imshow('edges',edges) cv2.imshow('thresh',thresh) # Press Q on keyboard to exit