Receipt OCR Tracker
Quick Start
- 1. Camera snap receipt → save ~/storage/downloads/photo.jpg
- cd scripts
- python3 ocr.py ~/storage/downloads/photo.jpg
- expenses.csv ready.
Examples
Grocery receipt:
Input: Milk $5.99, Bread $12.50, Total $19.24 (GST $1.75)
Output CSV:
date,item,amount,gst,total
2026-03-28,Milk,5.99,0.60,6.59
2026-03-28,Bread,12.50,1.25,13.75
Total,,19.24,1.85,21.09
Business lunch:
Parses subtotal, tax, tip, total.
Parsing Rules
- - Amount: \$(\d+\.\d{2})
- Date: \d{1,2}/\d{1,2}/\d{4}
- Item: Line before amount.
- Total: Last \$ line.
85% accuracy blurry OK.
Usage Workflow
User: "OCR this receipt photo.jpg"
Agent: exec ocr.py → CSV attach MD summary.
Troubleshooting
No tesseract: pkg install tesseract
Blurry: Resnap high light.
No PIL: pkg install python-pillow
收据OCR追踪器
快速开始
- 1. 用相机拍摄收据 → 保存至 ~/storage/downloads/photo.jpg
- 进入 scripts 目录
- 运行 python3 ocr.py ~/storage/downloads/photo.jpg
- 生成 expenses.csv 文件
示例
杂货收据:
输入:牛奶 $5.99,面包 $12.50,总计 $19.24(消费税 $1.75)
输出 CSV:
date,item,amount,gst,total
2026-03-28,牛奶,5.99,0.60,6.59
2026-03-28,面包,12.50,1.25,13.75
总计,,19.24,1.85,21.09
商务午餐:
解析小计、税费、小费、总计。
解析规则
- - 金额:\$(\d+\.\d{2})
- 日期:\d{1,2}/\d{1,2}/\d{4}
- 商品:金额前的行
- 总计:最后一行 \$ 金额
85% 准确率,模糊图片亦可处理。
使用流程
用户:OCR识别这张收据照片 photo.jpg
智能体:执行 ocr.py → 生成 CSV 并附加 Markdown 摘要。
故障排除
未安装 tesseract:运行 pkg install tesseract
图片模糊:重新拍摄,确保光线充足
未安装 PIL:运行 pkg install python-pillow