Skip to content

Add masked template matching (ignore background via mask/alpha)#339

Merged
JE-Chen merged 1 commit into
devfrom
feat/masked-template-batch
Jun 22, 2026
Merged

Add masked template matching (ignore background via mask/alpha)#339
JE-Chen merged 1 commit into
devfrom
feat/masked-template-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 22, 2026

Copy link
Copy Markdown
Member

Match icons / glyphs regardless of their background. Plain template matching scores every pixel, so an icon clipped from one background fails over a different one (hovered vs idle button, cursor over arbitrary content, themed logo).

  • match_masked / match_masked_all (AC_match_masked, AC_match_masked_all): count only the pixels you mark relevant — an explicit grayscale mask (non-zero = use), or, if the template is RGBA, its alpha channel. Transparent / "don't care" pixels stop dragging the score down.
  • Returns the same Match (x/y/size/score/center) as the scored template matcher. OpenCV masked TM_CCORR_NORMED (only normed metric that accepts a mask without NaNs); non-finite cells zeroed. Mask/template shape mismatch raises ValueError.
  • Injectable haystack (ndarray/path/PIL) → headless-testable on synthetic arrays. Wired through all 5 layers (core/facade/executor/MCP/Script Builder) + headless test + EN/Zh docs + WHATS_NEW. Qt-free.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 848c638 into dev Jun 22, 2026
15 of 16 checks passed
@JE-Chen JE-Chen deleted the feat/masked-template-batch branch June 22, 2026 19:39
@sonarqubecloud

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

1 participant