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/1_check_video_boundary.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/debug/1_check_video_boundary.py b/debug/1_check_video_boundary.py
index 90bcb17..0bafc91 100644
--- a/debug/1_check_video_boundary.py
+++ b/debug/1_check_video_boundary.py
@@ -17,9 +17,10 @@
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
contours, hierarchy = cv2.findContours(counter,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
contours_count = 0
+ image_h = image.shape[0]
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.6:
print((x, y, w, h))
cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
@@ -28,7 +29,7 @@
if cv2.waitKey(100) & 0xFF == ord('q'): #鎸塹閫�鍑�
cv2.waitKey(0)
-cap = cv2.VideoCapture("video.mp4") # for testing
+cap = cv2.VideoCapture("new.mp4") # for testing
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
--
Gitblit v1.9.1