From 69b8cbd754284a2071d06149f0c92d9fe50a744e Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期三, 23 三月 2022 12:14:34 +0800
Subject: [PATCH] add height check
---
debug/2_check_video_digits.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/debug/2_check_video_digits.py b/debug/2_check_video_digits.py
index b0e4bbb..d1213a4 100644
--- a/debug/2_check_video_digits.py
+++ b/debug/2_check_video_digits.py
@@ -56,8 +56,8 @@
res = cv2.matchTemplate(target_img, digitROI[0], cv2.TM_CCOEFF_NORMED)
max_val = cv2.minMaxLoc(res)[1]
source.append(max_val)
- # print(max(source))
- if max(source) > 0.5:
+ print(max(source))
+ if max(source) > 0.3:
return digits[source.index(max(source))][1]
else:
return "@"
@@ -77,7 +77,7 @@
return_numbers = []
for c in contours:
x, y, w, h = cv2.boundingRect(c)
- if hierarchy[0][contours_count][3] ==0 :
+ if hierarchy[0][contours_count][3] ==0 and h > image_h * 0.3:
#if image_h*0.98 > h > image_h * 0.3:
#print((x, y, w, h))
#cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
@@ -127,7 +127,7 @@
cv2.waitKey(0)
-cap = cv2.VideoCapture("7122.mp4") # for testing
+cap = cv2.VideoCapture("new.mp4") # for testing
total_frame = 0
while(cap.isOpened()):
ret, frame = cap.read()
--
Gitblit v1.9.1