| | |
| | | SERVER_HOST = "43.138.167.68" |
| | | # SERVER_HOST = "192.168.3.122" |
| | | WEB_HOST = "192.168.3.252" |
| | | IS_TEST = True |
| | | IS_TEST = False |
| | |
| | | # 实际位置(左,上,右,下) |
| | | rect = win32gui.GetWindowRect(hwnd) |
| | | |
| | | # 格式为:(上边距,宽度,高度) |
| | | # 格式为:(上边距,宽度,高度,缩放倍数) |
| | | rect_ = setting.get_ths_auto_code_rect() |
| | | # 测试 |
| | | scale = 1 if constant.IS_TEST else 1.5 |
| | |
| | | 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) |
| | |
| | | [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 |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | while True: |
| | | print( get_current_info()) |
| | | datas = get_current_info() |
| | | print(len(datas)) |
| | | time.sleep(3) |
| | |
| | | # 获取代码的最大色值 |
| | | 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] |
| | | # 从后往前找 |
| | |
| | | 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) |
| | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | __test4() |
| | | gray_img = cv2.imread('D:/test2.png', cv2.IMREAD_GRAYSCALE) |
| | | clip_ths_code_area(gray_img) |
| | | |
| | | if __name__ == "__main__1": |
| | | # |