summaryrefslogtreecommitdiff
path: root/proc.py
diff options
context:
space:
mode:
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])