Skip to content

Add 1-D barcode decoding (read_barcodes)#368

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

Add 1-D barcode decoding (read_barcodes)#368
JE-Chen merged 1 commit into
devfrom
feat/barcode-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

Summary

Adds read_barcodes — decode 1-D barcodes (EAN-13/8, UPC-A, Code-128) off the screen or an image via OpenCV's cv2.barcode.BarcodeDetector. Closes the gap left by read_qr (QR-only).

The decode step is an injectable seam: the default decoder calls OpenCV; tests pass their own decoder. The path is fully headless-testable and degrades gracefully — an OpenCV build without the barcode module returns [] instead of raising. Grayscale conversion reuses the shared visual_match haystack loader (no new image-loading code). Qt-free.

Layers

  • Core: utils/barcode/read_barcodes(source=None, *, region=None, decoder=None) → list of {text, type, points}.
  • Facade: re-exported from je_auto_control + __all__.
  • Executor: AC_read_barcodes (source / region{count, barcodes}).
  • MCP: ac_read_barcodes (read-only).
  • Script Builder: Read Barcodes (1-D) under OCR.
  • Docs: v157 EN + Zh + toctree.
  • Changelog: root EN + zh-TW + zh-CN.

Tests

test/unit_test/headless/test_barcode_batch.py — injected decoder, decoder-receives-image, blank→empty, full wiring (executor/MCP/Script Builder), facade exports. 5 passed. ruff / bandit / radon / float-scan / Qt-free all clean.

QR codes were decodable but not the EAN/UPC/Code-128 barcodes on physical
goods and shipping labels. Decode them via cv2.barcode with an injectable
decoder seam so the path is headless-testable and degrades to [] when the
OpenCV build lacks the barcode module.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity · 0 duplication

Metric Results
Complexity 18
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 f453138 into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/barcode-batch branch June 23, 2026 14:08
@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