gestures

[unmaintained] PoC for motion gesture detection from webcam input
Log | Files | Refs | README | LICENSE

commit f1137332a1b6bc104fde4c7d0d85d43cf0d8d1a2
parent a0dd6fde57ce762301d09dc43dae8aee5d2efe8b
Author: Stefan Koch <taikano@lavabit.com>
Date:   Sat, 15 Jun 2013 17:49:43 +0200

remove more noise

Diffstat:
Mtrack.py | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/track.py b/track.py @@ -10,6 +10,7 @@ import simplejson path = [] + def diffImg(t0, t1, t2): d1 = cv2.absdiff(t2, t1) d2 = cv2.absdiff(t1, t0) @@ -77,6 +78,8 @@ train_mode_pre = False train_mode = False train_target = 0 +ed_size = 50 + cam = cv2.VideoCapture(0) winName = "Movement Indicator" @@ -85,8 +88,8 @@ cv2.namedWindow(winName, cv2.CV_WINDOW_AUTOSIZE) img = cv2.cvtColor(cam.read()[1], cv2.COLOR_BGR2HSV) cv2.imwrite('test.jpg', img) img = cv2.inRange(img, (130, 50, 50), (160, 100, 100)) -img = cv2.erode(img, numpy.array([[1,1,1],[1,1,1],[1,1,1]])) -img = cv2.dilate(img, numpy.array([[1,1,1],[1,1,1],[1,1,1]]), iterations=3) +img = cv2.erode(img, numpy.array([[1] * ed_size] * ed_size), iterations=2) +img = cv2.dilate(img, numpy.array([[1] * ed_size] * ed_size), iterations=2) x1, y1 = pointer_pos(img) @@ -104,8 +107,8 @@ while True: img = cv2.cvtColor(cam.read()[1], cv2.COLOR_BGR2HSV) img = cv2.inRange(img, (70, 50, 50), (130, 200, 200)) - img = cv2.erode(img, numpy.array([[1,1,1,1,1,1,1],[1,1,1,1,1,1,1],[1,1,1,1,1,1,1],[1,1,1,1,1,1,1],[1,1,1,1,1,1,1],[1,1,1,1,1,1,1],[1,1,1,1,1,1,1]]), iterations=2) - img = cv2.dilate(img, numpy.array([[1,1,1],[1,1,1],[1,1,1]]), iterations=3) + img = cv2.erode(img, numpy.array([[1] * ed_size] * ed_size), iterations=2) + img = cv2.dilate(img, numpy.array([[1] * ed_size] * ed_size), iterations=2) x1, y1 = pointer_pos(img) if x1 != None and x0 != None and y1 != None and y0 != None: