Skip to content

Add icon_classify: classify a widget from its pixel shape#448

Merged
JE-Chen merged 1 commit into
devfrom
feat/icon-classify-batch
Jun 26, 2026
Merged

Add icon_classify: classify a widget from its pixel shape#448
JE-Chen merged 1 commit into
devfrom
feat/icon-classify-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

Summary

Sixth feature of the ROUND-15 perception lane. Set-of-Marks and element proposers return boxes but not what each box is; form_fields.checkbox_state reads a box already known to be a checkbox — the gap is the typing step before it.

  • Headless core utils/icon_classify/: box_features (extract {aspect, fill, edge_density, circularity} for a box — objective measurements), classify_widget (pure heuristic classifier: round→radio, wide-rounded→toggle, square-sparse→checkbox, wide-hollow→text_field, wide-filled→button, else icon), classify_icon (composes them → {type, features}). The classifier is pure and fully testable; cv2/numpy imported lazily so the module stays importable; reuses visual_match._to_gray.
  • 5 layers wired: facade __all__; AC_classify_widget (pure) + AC_classify_icon (device) executor commands; matching read-only ac_* MCP tools; Script Builder under Image.
  • Docs: EN + Zh v219_features_doc.rst + WHATS_NEW.md.

Test

test/unit_test/headless/test_icon_classify_batch.py — pure classifier for each widget type + defaults; cv2 box_features (circle rounder than square, circularity > 0.8), classify_icon detects a drawn radio dot, empty box; wiring + facade run cv2-free. All 13 green; ruff + bandit + radon clean (extracted _is_round/_is_pill to keep CC < C); no float ==; package stays Qt-free.

Set-of-Marks/element proposers return boxes but not what each box is;
form_fields.checkbox_state reads a box already known to be a checkbox.
box_features extracts {aspect, fill, edge_density, circularity};
classify_widget is the pure heuristic classifier (round->radio,
wide-rounded->toggle, square-sparse->checkbox, wide-hollow->text_field,
wide-filled->button, else icon); classify_icon composes them. cv2 lazy.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 0 duplication

Metric Results
Complexity 37
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 3328b9c into dev Jun 26, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/icon-classify-batch branch June 26, 2026 02:18
@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