Commit Graph
15 Commits
Author SHA1 Message Date
ilia 4be988093d Merge pull request 'Page-marker grouping, OCR improvements, homelab CI' (#3) from feature/grouping-ocr-ci into master
CI / python-ci (push) Successful in 1m9s
CI / secret-scan (push) Successful in 17s
2026-07-26 14:48:53 -05:00
ilia 23a44c37a1 Skip tesseract install in CI; Debian build misreads fixtures
CI / secret-scan (pull_request) Successful in 32s
CI / python-ci (pull_request) Successful in 1m37s
The OCR integration tests self-skip without the tesseract binary. Debian's tesseract reads the synthetic receipt dates differently than the brew build (2023 -> 2028), so keep those tests local-only for now.
2026-07-26 15:45:09 -04:00
ilia 732c0d4b99 Drop unused cv2 import flagged by ruff
CI / secret-scan (pull_request) Successful in 18s
CI / python-ci (pull_request) Failing after 1m39s
2026-07-26 15:38:06 -04:00
ilia 17be9cef33 Add homelab CI with hard ruff/pytest gates
Adds .gitea/workflows/ci.yml (python-ci with tesseract + libgl for the OCR/opencv tests, plus gitleaks secret-scan) and ruff.toml (E4/E7/E9/F/I, line-length 120). Cleans up the remaining unused-variable findings so the lint gate is green.
2026-07-26 15:37:45 -04:00
ilia 2ac7638e31 Update README for grouping/OCR changes
Documents multi-page grouping, the enhanced OCR chain, and new export naming; drops a personal verification aside in favor of neutral wording.
2026-07-26 15:37:37 -04:00
ilia 9af29dc614 Improve OCR extraction for pale dot-matrix statements
OCR enhancement chain (illumination normalize, CLAHE, gamma darkening) now always runs before Tesseract, with a conditional 1.5x upscale for narrow crops. Adds printed doc-title and PAGE X OF Y marker extraction.
2026-07-26 15:37:37 -04:00
ilia 12e5d1aeb1 Add page-marker grouping and party-aware naming
Consecutive captures whose printed PAGE X OF Y markers advance under the same total are grouped into one multi-page PDF, with duplicate pages keeping the better read. Naming gains doc-title/party components and a scan-date fallback so nothing lands in UNSORTED. Vision LLM default switches to minicpm-v (faster, fewer false blanks on dense mono pages).
2026-07-26 15:37:28 -04:00
ilia b11f46b00f Merge pull request 'Improve OCR on pale grey / low-res dot-matrix print' (#2) from feature/ocr-grey-print-upscale into master 2026-07-13 22:16:15 -05:00
ilia 764a0626b5 Improve OCR on pale grey / low-res dot-matrix print.
Add Lab gamma darkening and optional 1.5x cubic upscale (crops under 1800px) so faint TD-style ribbon ink is readable without slowing sharp captures. Add .gitleaks.toml so the pre-commit secret scan can load default rules.
2026-07-13 23:16:03 -04:00
ilia 7f67efdabf ci: add local pre-commit gitleaks hook 2026-07-13 15:00:53 -05:00
ilia 5be9d5935d Fix clipped receipt margins, add time-of-day naming, speed up rotation detection
- vision/document.py: pad_quad() expands the detected quad outward
  before warping so a straight-line contour fit doesn't clip the first
  character of every line on a slightly curled/wrinkled receipt
- ocr/extract.py + llm/vision.py: extract transaction time (HH:MM) so
  same-day repeat visits to a vendor get distinct filenames
  (2023-03-20_1525_walmart.pdf vs. a later same-day trip)
- vision/orient.py: downscale before Tesseract OSD/confidence-sweep
  rotation detection — this was the dominant cost in the detection
  phase (7x speedup: 472s -> 67s on a 36s test video)
2026-07-08 18:55:37 -04:00
ilia a43ab20df6 Add crop refinement, finger removal, and local LLM naming
- vision/refine.py: tighten crops to the paper band (removes mat
  margins and hands beside receipts) and inpaint border-connected
  skin regions so fingers disappear from output
- llm/vision.py: identify documents with a local Ollama vision model
  (qwen2.5vl); extracts vendor/date/total/form code and flags quality
  issues (fingers, blur, glare); falls back to Tesseract when down
- pipeline: drop blank pages, dedupe consecutive captures of the same
  document, record refine/LLM fields in report and export summary
2026-07-08 18:23:50 -04:00
ilia 2c28a623fb Add OCR naming and PNG-to-PDF export (modules 5-7, single-page only)
- ocr/: Tesseract-based vendor/date/total extraction. PSM 6 (single
  uniform text block) instead of the default fixes receipts where
  item-name/price columns were otherwise split into separate blocks and
  dropped. Vendor line picked by median (not max) word height within the
  top fraction of the crop, breaking ties by topmost line - max() was
  fooled by single descender/ascender glyphs (commas, parens) inflating
  one word's bounding box.
- naming/: merge OCR metadata into YYYY-MM-DD_vendor.pdf filenames,
  degrading gracefully to UNSORTED_<timestamp>.pdf; per-run dedup.
- pdf/: img2pdf-based multi-page-capable assembly (images_to_pdf).
- pipeline.run_export(): OCR + name + PDF each detected crop from a
  detect() report, writes pdf/ and export_summary.csv.
- New `paperpod export <video>` CLI command.
- Verified against synthetic Home Depot/Metro/Petro-Canada receipts:
  3/3 correct vendor, date, and total after tuning.

Known limitation (documented in README): no page-flip/multi-page
grouping yet (that's events/, still unbuilt) - every detected document
becomes its own single-page PDF.
2026-07-07 18:04:06 -04:00
ilia 8f5be59b7e Add realistic receipt test video generator
Renders three thermal-paper style receipts with real text (Home Depot,
Metro, Petro-Canada) placed one at a time on a black mat with hand motion
and drop shadows, matching the recommended real-world recording setup.
Verified: detect finds all 3 receipts, 7 stable windows, clean crops.
2026-07-07 17:11:28 -04:00
ilia 6a78c84bcd Initial scaffold: capture + vision modules with detect CLI
- capture/: frame sampling at configurable fps, ffmpeg audio extraction (WAV, whisper-ready)
- vision/: changed-pixel motion scoring, stable/moving segmentation, contour + perspective document detection, Laplacian sharpness scoring, optional CLAHE enhancement
- pipeline: two-pass detect (motion timeline, then best-frame crop per stable window) writing crops, debug frames, report.json, and motion_scores.csv
- CLI: probe / detect / extract-audio subcommands
- config.yaml with tunable thresholds; placeholder packages for events, transcribe, ocr, naming, pdf, review_cli
- synthetic sample video generator + 16 unit tests
2026-07-07 16:24:46 -04:00