Commit 629c09b0 authored by rokka's avatar rokka

modified device 8

parent ba94d48b
Pipeline #1 failed with stages
......@@ -27,7 +27,7 @@ def print_mouse_coords(event, x, y, flags, param):
print("[" + str(x) + ", " + str(y) + "]")
if event == cv2.EVENT_RBUTTONDBLCLK:
r = cv2.selectROI(warped)
r = cv2.selectROI(img[1])
print("[" + str(r[1]) + ":" + str(r[1] + r[3]) + ", " + str(r[0]) + ":" + str(r[0] + r[2]) + "]")
......
......@@ -116,7 +116,6 @@ The BASE-TECH Thermometer
right=border_size,
borderType=cv2.BORDER_CONSTANT, value=[255, 255, ])
kernel_1 = np.ones((4, 4), np.uint8)
thresh1_dilated = cv2.dilate(thresh1, kernel_1, iterations=2)
......@@ -346,7 +345,7 @@ IDF radio-alarm
kernel_1 = np.ones((3, 3), np.uint8)
dilated = cv2.dilate(warped, kernel_1, iterations=1)
processed = [ thresh1, dilated]
processed = [thresh1, dilated]
return processed
......@@ -426,6 +425,7 @@ SEVERIN Microwave
return warped
# Device ID 12
def image_device_12(img):
"""
......@@ -455,6 +455,7 @@ Bloodpressure
return bordered
# Device ID 0
def image_device_13(img):
"""
......@@ -471,12 +472,9 @@ BASETECH piggybank
warped = cv2.warpPerspective(gray, m, (width, height))
ret, thresh1 = cv2.threshold(warped, 55, 255, cv2.ADAPTIVE_THRESH_MEAN_C)
cv2.imshow("warped", warped)
cv2.imshow("thresh", thresh1)
cv2.waitKey(1)
return thresh1
\ No newline at end of file
return thresh1
......@@ -207,9 +207,23 @@ IDR radio alarm
for result in rois_processed[0]:
print(result)
results_processed = None
first_digits = re.sub("[^0-9]", "", str(rois_processed[0][0]).rstrip())
second_digits = re.sub("[^0-9]", "", str(rois_processed[0][1]).rstrip())
if rois_processed[1][0]:
results_processed = first_digits + ":" + second_digits + " Uhr"
if rois_processed[1][3] or rois_processed[1][4]:
results_processed = str(results_processed) + " Alarm 1 an."
if rois_processed[1][5] or rois_processed[1][6]:
results_processed = str(results_processed) + " Alarm 2 an."
if rois_processed[1][2]:
results_processed = first_digits + second_digits[0] + "." + second_digits[1] + " Mhz"
return results_processed
......@@ -249,7 +263,6 @@ def process_results_device_10(rois_processed):
return results_processed
def process_results_device_11(rois_processed):
# TODO: Process results
"""
......@@ -304,10 +317,11 @@ Bloodpressure
if len(diastolic_digits) > 1:
results_processed = "Blutdruck " + str(systolic_digits) + " zu " + str(diastolic_digits) + " . " + "Puls: " \
+ str(heartrate)
+ str(heartrate)
return results_processed
def process_results_device_13(rois_processed):
"""
Dummy Device
......@@ -319,13 +333,9 @@ Dummy Device
digits = re.sub('[^0-9]', '', rois_processed[0][0].rstrip())
temp_result_pattern = re.compile("\d?\d")
return results_processed
def process_results_device_XX(rois_processed):
"""
......
......@@ -16,6 +16,14 @@
import cv2
import numpy as np
def print_mouse_coords(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
print("[" + str(x) + ", " + str(y) + "]")
if event == cv2.EVENT_RBUTTONDBLCLK:
r = cv2.selectROI(warped)
print("[" + str(r[1]) + ":" + str(r[1] + r[3]) + ", " + str(r[0]) + ":" + str(r[0] + r[2]) + "]")
def roi_device_0(img):
"""
......@@ -303,6 +311,10 @@ IDR radio alarmclock
:param imgs:
:return:
"""
#
# cv2.namedWindow("1", cv2.WINDOW_GUI_EXPANDED)
#
# cv2.setMouseCallback("1", print_mouse_coords)
kernel_1 = np.ones((3, 3), np.uint8)
......@@ -310,7 +322,7 @@ IDR radio alarmclock
digits_3_4 = img[1][1:160, 311:595].copy()
double_dot_lower = img[1][99:126, 275:307].copy()
double_dot_upper = img[1][36:68, 284:317].copy()
double_dot_upper = img[1][10:68, 300:317].copy()
decimal_dot = img[1][127:158, 437:479].copy()
......@@ -332,12 +344,16 @@ IDR radio alarmclock
left_point_2, left_point_3,
right_point_1, right_point_2, right_point_3]
cv2.imshow("1", digits_1_2)
cv2.imshow("2", digits_3_4)
# cv2.imshow("1", digits_1_2)
# cv2.imshow("2", digits_3_4)
# cv2.imshow("3", right_point_3)
# cv2.imshow("4", double_dot_upper)
# cv2.imshow("5", double_dot_lower)
cv2.waitKey(1)
# cv2.imshow("6", left_point_2)
# cv2.imshow("7", left_point_3)
# cv2.imshow("8", right_point_2)
# cv2.imshow("9", right_point_1)
# cv2.imshow("10", )
# cv2.waitKey(1)
return [ocr_rois, feat_detect_rois]
......
......@@ -163,8 +163,9 @@ IDR alarm-clock :param rois:
"""
device_ssocr_args = [
"-d", "-1",
"-i", "3",
"-n", "10",
# "-i", "3",
# "-n", "10",
"-m", "20",
"-c", "digits"
"-C"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment