Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ocr识别“太卜司”出错导致无法在仙舟右侧正常选中。导致锄地卡死 #700

Closed
aq44634 opened this issue Jul 29, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@aq44634
Copy link

aq44634 commented Jul 29, 2023

问题描述

锄大地卡在太卜司2图

预期行为

可以正常运行

实际行为

calculated.part_ocr 识别结果大概率出现“太下司”而不是“太卜司”。
导致
11:10:35 - DEBUG | calculated.click_target:355 - v1.7.4/20230723140607/20230723140607 - 太卜司
11:10:35 - DEBUG | calculated.click_target:358 - v1.7.4/20230723140607/20230723140607 - None
没正常点击【太卜司】

截图或录屏

No response

自动锄大地脚本版本

1.7.4

星穹铁道区服

国服

运行的客户端

PC

日志

日志文件.2023-07-28_11-22-20_283383.log

@aq44634 aq44634 added the bug Something isn't working label Jul 29, 2023
@aq44634
Copy link
Author

aq44634 commented Jul 29, 2023

建议直接对【太下司】兜底

我的蠢办法:

def part_ocr(self,points = (0,0,0,0), debug=False, only_white=False):
        """
        说明:
            返回图片文字和坐标(相对于图片的坐标)
        参数:
            :param points: 图像截取范围
        返回:
            :return data: 文字: 坐标(相对于图片的坐标)
        """
        img_fp, left, top, right, bottom, width, length = self.take_screenshot(points)
        if only_white:
            img_fp = self.remove_non_white_pixels(img_fp)
        if debug:
            show_img(img_fp)
            cv.imwrite("H://xqtd//xl//test.png",img_fp)
        x, y = width/100*points[0], length/100*points[1]
        out = self.ocr.ocr(img_fp)
        data = {i['text']: (int(left+x+(i['position'][2][0]+i['position'][0][0])/2),int(top+y+(i['position'][2][1]+i['position'][0][1])/2)) for i in out}
#
        if "太下司" in data:
            data["太卜司"] = data["太下司"]
            del data['太下司']
#
        log.debug(data)
        return data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants