From 9fda3f7316f104f9288f3c1ee5671667951e7519 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期五, 25 三月 2022 15:49:33 +0800
Subject: [PATCH] 识别宽的情况 人工拆分

---
 debug/1_check_video_boundary.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/debug/1_check_video_boundary.py b/debug/1_check_video_boundary.py
index 97f0030..b6a1942 100644
--- a/debug/1_check_video_boundary.py
+++ b/debug/1_check_video_boundary.py
@@ -5,7 +5,7 @@
 from cv2 import waitKey
 import uuid
 from _image_clip_setting import image_clip
-
+import sys
 
 def check_frame(frame):
     image = frame[image_clip[0]:image_clip[1], image_clip[2]:image_clip[3]]
@@ -13,7 +13,7 @@
     gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
     thresh = cv2.threshold(gray, 0, 255,
                        cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
-    kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
+    kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (6, 6))
     counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
     contours, hierarchy = cv2.findContours(counter,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
     contours_count = 0
@@ -21,7 +21,6 @@
     for c in contours:
         x, y, w, h = cv2.boundingRect(c)
         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)
         contours_count += 1
@@ -29,7 +28,7 @@
     if cv2.waitKey(100) & 0xFF == ord('q'): #鎸塹閫�鍑�
         cv2.waitKey(0)
         
-cap = cv2.VideoCapture("new.mp4")  # for testing
+cap = cv2.VideoCapture(sys.argv[1])  # for testing
 while(cap.isOpened()):
     ret, frame = cap.read()
     if ret==True:

--
Gitblit v1.9.1