| | |
| | | from http.server import BaseHTTPRequestHandler |
| | | import cv2 |
| | | |
| | | import ths_industry_util |
| | | import constant |
| | | from utils import ths_industry_util |
| | | from ocr import ocr_util |
| | | from ocr.ocr_util import OcrUtil |
| | | from third_data import kpl_util |
| | | from trade import bidding_money_manager |
| | | |
| | |
| | | for r in range(0, rows): |
| | | for c in range(0, cols): |
| | | mat[r][c] = [datas[r * cols + c]] |
| | | # cv2.imwrite("D:/test.png", mat) |
| | | # cv2.imwrite(f"{constant.get_path_prefix()}/test.png", mat) |
| | | ocr_results = ocr_util.OcrUtil.ocr_with_key(mat, key) |
| | | if not ocr_results: |
| | | # 多重识别,防止识别出错 |
| | |
| | | for r in range(0, rows): |
| | | for c in range(0, cols): |
| | | mat[r][c] = [datas[r * cols + c]] |
| | | # cv2.imwrite("D:/test.png", mat) |
| | | # cv2.imwrite(f"{constant.get_path_prefix()}/test.png", mat) |
| | | ocr_results = ocr_util.OcrUtil.ocr_with_key(mat, ".") |
| | | code_name = "" |
| | | for res in ocr_results: |
| | |
| | | kpl_datas = kpl_util.parse_kpl_datas(results) |
| | | if kpl_datas: |
| | | bidding_money_manager.set_bidding_money(kpl_datas) |
| | | with open("D:/kpl.png", mode="wb") as f: |
| | | with open(f"{constant.get_path_prefix()}/kpl.png", mode="wb") as f: |
| | | f.write(imgdata) |
| | | except Exception as e: |
| | | logging.exception(e) |