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

[建议] TemplateMatch支持额外的颜色要求字段 #391

Open
moulai opened this issue Oct 14, 2024 · 1 comment
Open

[建议] TemplateMatch支持额外的颜色要求字段 #391

moulai opened this issue Oct 14, 2024 · 1 comment

Comments

@moulai
Copy link

moulai commented Oct 14, 2024

需求

希望TemplateMatch能支持颜色要求,可以通过增添颜色要求字段实现。

场景

TemplateMatch匹配时基本靠灰度匹配,不考虑颜色。有时需要既满足TemplateMatch又满足颜色,才能正确匹配到想要的图片。

例子

  • 希望匹配到的图片1:
    image

  • 不应该被匹配到的图片2(弹窗后加上灰色蒙版,TemplateMatch分数仍然达0.99以上,OCR仍能正常识别到文字):
    image

  • 尝试过仅使用ColorMatch方法,但某些情况会出错(如转场加载时会全白)。

虽然“串联任务”在一定程度上可以实现本需求(如Task0→Task1 TemplateMatch→Task2 ColorMatch),但是这样需要写多个中间任务并可能出现“回滚”的死循环。(见 #386

建议

为TemplateMatch加颜色要求字段,仅在TemplateMatch到的结果上加一个颜色判断就可以,也能解决颜色不敏感的问题。例如:

recognition: "TemplateMatch",
template_color: {method: 4, lower: [], upper: [], count: 1}, //默认为False?
@MistEO
Copy link
Member

MistEO commented Oct 18, 2024

一个 workaround,你把 method 换成 1 或者 3 试试

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