From 937e978c3cf5ba2b11f60c9622c828885798c268 Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Tue, 17 Jan 2017 17:39:50 +0000 Subject: semifunctional capball and particle detection and differentiation --- proc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'proc.py') diff --git a/proc.py b/proc.py index 7bdef13..607d424 100644 --- a/proc.py +++ b/proc.py @@ -17,8 +17,10 @@ h,s,v = cv2.split(himg) #blue is 195-135, 40? really that much? #hue only testing, not very effective. # better with saturation -thresh = cv2.bitwise_and(cv2.bitwise_or(thresh(h,0,10),thresh(h,169,180)), thresh(s,60,255)) -#thresh = cv2.bitwise_and(thresh(h,95,135), thresh(s,60,255)) +#red +#thresh = cv2.bitwise_and(cv2.bitwise_or(thresh(h,0,10),thresh(h,169,180)), thresh(s,60,255)) +#blue +thresh = cv2.bitwise_and(thresh(h,95,135), thresh(s,60,255)) #thresh = cv2.GaussianBlur(thresh,(29,29),0,0,cv2.BORDER_REFLECT_101) cv2.imwrite("stallmask.jpg",thresh); mask = cv2.merge((thresh,thresh,thresh)) @@ -28,7 +30,7 @@ cv2.imwrite("stallmasked.jpg",cv2.cvtColor(masked,cv2.COLOR_HSV2BGR)); im2, con, heir = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) v = 0 for i in range(0, len(con)) : - if (cv2.contourArea(con[i]) > 2000) : + if (cv2.contourArea(con[i]) > 1000) : a = cv2.contourArea(con[i]) cv2.drawContours(masked, con, i, (120,255,255), 5) (cx, cy), r = cv2.minEnclosingCircle(con[i]) -- cgit v1.1