From 42107c75fc28284b6e4c9c5b6149886b2e5d6c67 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期三, 23 三月 2022 15:35:49 +0800
Subject: [PATCH] 缩小模糊边界
---
debug/2_check_frame_digits.py | 2 +-
debug/1_check_video_boundary.py | 2 +-
debug/2_split_digit_from_video.py | 2 +-
debug/__pycache__/_image_clip_setting.cpython-36.pyc | 0
extract_voltage_task.py | 2 +-
debug/1_check_frame_boundary.py | 2 +-
debug/2022.jpg | 0
debug/_image_clip_setting.py | 1 +
debug/2_check_video_digits.py | 4 ++--
9 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/debug/1_check_frame_boundary.py b/debug/1_check_frame_boundary.py
index b958d23..1fdfd8a 100644
--- a/debug/1_check_frame_boundary.py
+++ b/debug/1_check_frame_boundary.py
@@ -12,7 +12,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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
contours, hierarchy = cv2.findContours(counter,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
contours_count = 0
diff --git a/debug/1_check_video_boundary.py b/debug/1_check_video_boundary.py
index 0bafc91..97f0030 100644
--- a/debug/1_check_video_boundary.py
+++ b/debug/1_check_video_boundary.py
@@ -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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
contours, hierarchy = cv2.findContours(counter,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
contours_count = 0
diff --git a/debug/2022.jpg b/debug/2022.jpg
new file mode 100644
index 0000000..c6331d9
--- /dev/null
+++ b/debug/2022.jpg
Binary files differ
diff --git a/debug/2_check_frame_digits.py b/debug/2_check_frame_digits.py
index 9c7a907..571110e 100644
--- a/debug/2_check_frame_digits.py
+++ b/debug/2_check_frame_digits.py
@@ -67,7 +67,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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
image_h = image.shape[0]
contours, hierarchy = cv2.findContours(counter,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
diff --git a/debug/2_check_video_digits.py b/debug/2_check_video_digits.py
index d1213a4..36c074c 100644
--- a/debug/2_check_video_digits.py
+++ b/debug/2_check_video_digits.py
@@ -68,7 +68,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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
image_h = image.shape[0]
contours, hierarchy = cv2.findContours(
@@ -127,7 +127,7 @@
cv2.waitKey(0)
-cap = cv2.VideoCapture("new.mp4") # for testing
+cap = cv2.VideoCapture("video.mp4") # for testing
total_frame = 0
while(cap.isOpened()):
ret, frame = cap.read()
diff --git a/debug/2_split_digit_from_video.py b/debug/2_split_digit_from_video.py
index c31f746..cbadf7c 100644
--- a/debug/2_split_digit_from_video.py
+++ b/debug/2_split_digit_from_video.py
@@ -11,7 +11,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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
contours, hierarchy = cv2.findContours(
counter, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
diff --git a/debug/__pycache__/_image_clip_setting.cpython-36.pyc b/debug/__pycache__/_image_clip_setting.cpython-36.pyc
index 979dbc2..5c87918 100644
--- a/debug/__pycache__/_image_clip_setting.cpython-36.pyc
+++ b/debug/__pycache__/_image_clip_setting.cpython-36.pyc
Binary files differ
diff --git a/debug/_image_clip_setting.py b/debug/_image_clip_setting.py
index ddbc326..21cfd77 100644
--- a/debug/_image_clip_setting.py
+++ b/debug/_image_clip_setting.py
@@ -3,3 +3,4 @@
image_clip = [176,234,278,422] # for video.mp4
#image_clip = [226,266,200,300] # for new.mp4
+#image_clip = [220,275,210,300] # test image
diff --git a/extract_voltage_task.py b/extract_voltage_task.py
index beb438a..094235e 100644
--- a/extract_voltage_task.py
+++ b/extract_voltage_task.py
@@ -67,7 +67,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, (6, 6))
+ kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
counter = cv2.morphologyEx(thresh.copy(), cv2.MORPH_OPEN, kernel)
contours, hierarchy = cv2.findContours(counter, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
return_numbers = []
--
Gitblit v1.9.1