From c71c82a8f1da678da740b726a66ab5bc9955b261 Mon Sep 17 00:00:00 2001 From: Alexander Mordvintsev Date: Wed, 27 Jun 2012 09:46:04 +0000 Subject: [PATCH] work on digits_video.py --- samples/python2/digits_video.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/python2/digits_video.py b/samples/python2/digits_video.py index 350a637e5f..04b272f2e6 100644 --- a/samples/python2/digits_video.py +++ b/samples/python2/digits_video.py @@ -31,14 +31,14 @@ def main(): boxes = [] for cnt in contours: x, y, w, h = cv2.boundingRect(cnt) - if h < 20 or h > 60 or 1.2*h < w: + if h < 16 or h > 60 or 1.2*h < w: continue cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0)) sub = bin[y:,x:][:h,:w] #sub = ~cv2.equalizeHist(sub) #_, sub_bin = cv2.threshold(sub, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU) - s = 1.1*h/SZ + s = float(h)/SZ m = cv2.moments(sub) m00 = m['m00'] if m00/255 < 0.1*w*h or m00/255 > 0.9*w*h: @@ -49,7 +49,7 @@ def main(): c0 = np.float32([SZ/2, SZ/2]) t = c1 - s*c0 A = np.zeros((2, 3), np.float32) - A[:,:2] = np.eye(2)*2 + A[:,:2] = np.eye(2)*s A[:,2] = t sub1 = cv2.warpAffine(sub, A, (SZ, SZ), flags=cv2.WARP_INVERSE_MAP | cv2.INTER_LINEAR) sub1 = digits.deskew(sub1)