admin
2024-04-16 2a2e183770e86c231ac732701fb179a604b61b23
bug修改
6个文件已修改
24 ■■■■■ 已修改文件
constant.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
gui_wx.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
res/codes.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
res/setting.conf 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/l1_data_api.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/opencv_util.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constant.py
@@ -1,4 +1,4 @@
SERVER_HOST = "43.138.167.68"
# SERVER_HOST = "192.168.3.122"
WEB_HOST = "192.168.3.252"
IS_TEST = True
IS_TEST = False
gui_wx.py
@@ -457,7 +457,7 @@
    # 实际位置(左,上,右,下)
    rect = win32gui.GetWindowRect(hwnd)
    # 格式为:(上边距,宽度,高度)
    # 格式为:(上边距,宽度,高度,缩放倍数)
    rect_ = setting.get_ths_auto_code_rect()
    # 测试
    scale = 1 if constant.IS_TEST else 1.5
@@ -466,6 +466,8 @@
    width = int((rect[2] - rect[0]) * scale)
    left = width - rect_[1]
    img = win32_util.window_capture(hwnd, (left, rect_[0], width - 1, rect_[0] + rect_[2]), scale)
    if int(time.time()) % 5 == 0:
        cv2.imwrite(f"test2.png", opencv_util.gray_img(img))
    clip_img, details = opencv_util.clip_ths_code_area(img)
    start_time = time.time()
    code = ocr_util.recognize_code(clip_img)
res/codes.txt
@@ -1 +1 @@
603825
601766
res/setting.conf
@@ -1,10 +1,10 @@
[config]
stay_on_top = 1
window_info = [[-1711, 194, 1280, 800], [1473, 621, 320, 195]]
xgb_window_info = [61, 277, 1527, 918]
xgb_window_info = [-71, 121, 1046, 885]
window_watch_float_info = [146, 419, 435, 220]
window_tick_info = [-1487, 213, 1227, 661]
kp_second_window_info = [-594, 109, 1538, 1017]
window_tick_info = [-1799, 324, 1223, 665]
kp_second_window_info = [130, 295, 730, 974]
code_attribute_window_info = [-650, 315, 291, 278]
client = hxh
float_frame_auto_focus = 1
utils/l1_data_api.py
@@ -68,5 +68,6 @@
if __name__ == "__main__":
    while True:
        print( get_current_info())
        datas = get_current_info()
        print(len(datas))
        time.sleep(3)
utils/opencv_util.py
@@ -134,7 +134,7 @@
    # 获取代码的最大色值
    max_color = 0
    for r in range(start_row, end_row + 1):
        for c in range(cols - 1, start_col + (cols - start_col) // 2, -1):
        for c in range(cols - 1, start_col + (cols - start_col) // 3, -1):
            if img[r][c] > max_color:
                max_color = img[r][c]
    # 从后往前找
@@ -168,7 +168,7 @@
        plt.show()
    clip_img = img[start_row:end_row, codes_pos[0][0]:codes_pos[-1][1]]
    # cv2.imwrite("test1.png", clip_img)
    cv2.imwrite("test1.png", clip_img)
    return clip_img, img_detail
    # print(clip_img.shape)
@@ -218,7 +218,8 @@
if __name__ == '__main__':
    __test4()
    gray_img = cv2.imread('D:/test2.png', cv2.IMREAD_GRAYSCALE)
    clip_ths_code_area(gray_img)
if __name__ == "__main__1":
    #