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

二维码识别问题,不支持彩色二维码识别 #512

Open
1 task done
neauxty opened this issue May 10, 2024 · 6 comments
Open
1 task done

二维码识别问题,不支持彩色二维码识别 #512

neauxty opened this issue May 10, 2024 · 6 comments

Comments

@neauxty
Copy link

neauxty commented May 10, 2024

Issues

  • I have browsed through the Issues. 我已浏览过Issues,确定没有重复提问。

Umi-OCR version 程序版本

2.1.1

Windows version 系统版本

win10

OCR plugins Used 使用的OCR插件

PaddleOCR

Reproduction steps 复现步骤

大佬您好,我这边需要对微信二维码进行识别,通过http请求测试了一下您写的插件,微信彩色二维码识别不了,我看第三方可能先是做了灰度反差处理,进行识别的,有空能不能看下(草料二维码有类似的功能,他们是纯前端识别的,不知道有没有参考价值)

Problem screenshots or related files (optional) 问题截图或相关文件(可选)

WechatIMG223

@hiroi-sora
Copy link
Owner

hiroi-sora commented May 10, 2024

你好,Umi是支持灰度/二值化的哦,不过暂无法智能判断,需要用户手动设定、调参。

二维码标签页 → 设置 → 勾选 高级 → 勾选 转为灰度二值化 填写 200

就可以识别您的样例啦

image

@neauxty
Copy link
Author

neauxty commented May 10, 2024

你好,Umi是支持灰度/二值化的哦,不过暂无法智能判断,需要用户手动设定、调参。

二维码标签页 → 设置 → 勾选 高级 → 勾选 转为灰度二值化 填写 200

就可以识别您的样例啦

image

大佬,这个客户端试了的确可以,我是用http请求测得,还是显示101

@hiroi-sora
Copy link
Owner

哦,抱歉,HTTP接口暂时不套用软件界面上的设定,需要手动修改代码来传入设定。

请打开 UmiOCR-data\py_src\server\cmd_server.py ,第291行,将

                res = MissionQRCode.addMissionWait({}, [{"pil": pil}])

修改为:

                argd = {
                    "preprocessing.grayscale": True,
                    "preprocessing.threshold": 200,
                }
                res = MissionQRCode.addMissionWait(argd, [{"pil": pil}])

这样就能修改HTTP接口的参数了。

image

更多可设定参数为:

  • "preprocessing.median_filter_size": 中值滤波器的大小,应为1~9的奇数。默认不进行。
  • "preprocessing.sharpness_factor": 锐度增强因子,应为0.1~10。默认不调整锐度。
  • "preprocessing.contrast_factor": 对比度增强因子,应为0.1~10。大于1增强对比度,小于1但大于0减少对比度,1保持原样。默认不调整对比度。
  • "preprocessing.grayscale": 布尔值,指定是否将图像转换为灰度图像。True为转换,False为不转换。默认为False。
  • "preprocessing.threshold": 二值化阈值,用于灰度图像的二值化处理。应为0到255之间的整数。只有当"preprocessing.grayscale"为True时,此参数才生效。默认不进行二值化处理。

@neauxty
Copy link
Author

neauxty commented May 10, 2024

按照图示改完了,还是识别不了,也重启过
image

@hiroi-sora
Copy link
Owner

hiroi-sora commented May 21, 2024

抱歉,我之前看错了文件。

应该在 UmiOCR-data\py_src\server\qrcode_server.py ,第11行,修改addMissionWait的参数,即:

def base2text(base64):
    argd = {
        "preprocessing.grayscale": True,
        "preprocessing.threshold": 200,
    }
    res = MissionQRCode.addMissionWait(argd, [{"base64": base64}])
    return res[0]["result"]

我正在将这部分纳入修改,下版本将能够在http指令中,传入二维码的调节参数。

@neauxty
Copy link
Author

neauxty commented May 21, 2024

嗯嗯,感谢大佬,测试没问题👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants