Metadata-Version: 2.4
Name: wx_paper_parser
Version: 1.1.32
Summary: Answer sheet ID recognition
Author: asan
License: GPL-3.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: opencv-python>=4.8
Requires-Dist: numpy>=2.0
Requires-Dist: onnxruntime>=1.16
Requires-Dist: pyyaml>=6.0
Requires-Dist: zxing-cpp>=3.0
Requires-Dist: shapely>=2.0
Requires-Dist: Pillow>=10.0

# wx_paper_parser

> Answer-sheet student-ID recognition library — barcode / QR + handwritten bubble filling, with CNN OCR fallback.

答题卡学号识别库。从扫描或拍摄的答题卡图像中识别考号（条码 / 二维码 + 手写填涂）。

## 识别流程

入口 `EnhanceIdExtractor` 按速度优先依次 fallback：

```
条码 / 二维码 → CNN 检测 + OCR → 遗留识别器
```

- **条码 / 二维码**：最快，命中即返回
- **CNN 检测 + 手写 OCR**：定位学号区域并逐位识别
- **遗留识别器**：兼容旧版填涂式布局

## 安装

```bash
pip install wx_paper_parser
```

## 依赖

安装时自动拉取：`opencv-python`、`numpy`、`onnxruntime`、`pyyaml`、`zxing-cpp`、`shapely`。

要求 Python ≥ 3.10。

## 用法

```python
import cv2
from wx_paper_parser import EnhanceIdExtractor

extractor = EnhanceIdExtractor()                     # 默认使用包内模型，懒加载
img = cv2.imread("answer_sheet.jpg")

angle, corrected = extractor.correct_direction(img)  # 校正纸张方向
student_id = extractor.read_code(corrected)          # 识别学号
print(student_id)
```

## 主要模块

| 名称 | 说明 |
| --- | --- |
| `EnhanceIdExtractor` | 识别入口，按速度优先 fallback |
| `read_barcode` | 条码 / 二维码读取 |
| `CNNIdRecognizer` | CNN 检测 + OCR 管线 |
| `CompositionIdRecognizer` | 遗留识别器 |

完整导出见 `wx_paper_parser/__init__.py`。

## License

GPL-3.0
