Add edge_match: edge-shape (Chamfer) template matching#380
Merged
Conversation
Intensity NCC drops when a control is re-filled or re-themed, and ORB needs corner texture flat-design glyphs lack. Match by edge shape instead: Canny both images, distance-transform the scene edges, slide the template's edges over it and score by mean edge-to-edge distance (Chamfer). A perfect outline aligns at ~0 cost regardless of fill. Reuses visual_match's loaders/resize/NMS/Match and edge_lines's Canny default.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 0 |
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要
新增
edge_match/edge_match_all/chamfer_distance— 以邊緣形狀(Chamfer / 距離轉換)定位模板。強度相關(visual_match)在同一控制項以不同填充 / 漸層 / 主題 / 抗鋸齒繪製時分數下降;ORB 特徵比對(feature_match)需要扁平設計圖示(漢堡選單、單純箭號)缺乏的角點紋理。本功能改以邊緣形狀比對:對兩圖跑 Canny,對場景邊緣建立距離轉換,把模板邊緣滑過它,以「每個模板邊緣到最近場景邊緣的平均距離」評分(Chamfer)。完美對齊的成本約為 0,與形狀如何填充 / 著色無關。重用
visual_match的灰階載入器 / resize / NMS /Match與edge_lines的 Canny 預設。haystack可注入;Qt-free。五層
utils/edge_match/—edge_match、edge_match_all、chamfer_distance。je_auto_control匯出 +__all__。AC_edge_match({found, match})/AC_edge_match_all({count, matches})。ac_edge_match/ac_edge_match_all(read-only)。測試
test/unit_test/headless/test_edge_match_batch.py— 不同灰階仍以輪廓找到形狀(score>=0.9、位置正確)、chamfer 距離近 0、空白→None、edge_match_all NMS 去重。6 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。