Skip to content

Add perceptual (YIQ) image diff with anti-alias suppression#360

Merged
JE-Chen merged 1 commit into
devfrom
feat/perceptual-diff-batch
Jun 23, 2026
Merged

Add perceptual (YIQ) image diff with anti-alias suppression#360
JE-Chen merged 1 commit into
devfrom
feat/perceptual-diff-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

image_difference counts raw per-channel max-delta pixels and ssim_compare is a global score — neither uses a perceptual colour metric nor ignores anti-aliased edges, the #1 source of false-positive visual-diff failures across DPI / font-hinting.

  • perceptual_diff (AC_perceptual_diff): compares pixels in YIQ space (pixelmatch's colour metric) and by default removes thin 1px anti-aliased edge differences via a morphological open, so only solid changes count (include_aa=True keeps them). Returns PerceptualDiffResult (diff_pixels, total_pixels, diff_ratio, regions).
  • assert_perceptual / executor max_diff_ratio: gate a visual-regression test (raises over budget).
  • Reuses color_region's RGB loader + cv2_utils.blobs.connected_boxes (no copies); injectable image pair → headless-testable (a 1px fringe → 0 diffs with AA suppression, a solid block → counted). Base OpenCV. Wired through all 5 layers + headless test + EN/Zh docs + WHATS_NEW. Qt-free.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 24 complexity · 0 duplication

Metric Results
Complexity 24
Duplication 0

View in Codacy

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 79f3bc7 into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/perceptual-diff-batch branch June 23, 2026 03: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