summaryrefslogtreecommitdiff
path: root/proc.py
diff options
context:
space:
mode:
authorknolax <1339802534.kk@gmail.com>2017-01-17 17:39:50 +0000
committerknolax <1339802534.kk@gmail.com>2017-01-17 17:39:50 +0000
commit937e978c3cf5ba2b11f60c9622c828885798c268 (patch)
tree9ce574205481ec68508565c7b518863c33d2df20 /proc.py
parent4788300a8787c901f7d1bdec46d3c2553357736e (diff)
semifunctional capball and particle detection and differentiationstable
Diffstat (limited to 'proc.py')
-rw-r--r--proc.py8
1 files changed, 5 insertions, 3 deletions
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])