6 Commits
Author SHA1 Message Date
Adrian Kuman FirmansahandGitHub dbcf480130 Merge pull request #8 from Adriankf59/devin/1777181072-fix-personnel-extraction-cimahi
Fix personnel extraction + header bugs on real Polres Cimahi sprint
2026-04-26 13:10:44 +07:00
Adrian Kuman FirmansahandGitHub dce77e80e1 Merge pull request #7 from Adriankf59/devin/1777149159-phase-7-followup-empty-dict-consistency
Fix empty-dict consistency in ground-truth export (follow-up to #6)
2026-04-26 03:34:22 +07:00
Adrian Kuman FirmansahandGitHub 5ea45de5ea Merge pull request #6 from Adriankf59/devin/1777148426-phase-7-ground-truth
Phase 7: ground-truth export (JSONL + stats) + CLI tool
2026-04-26 03:32:31 +07:00
Adrian Kuman FirmansahandGitHub 9457fa3c55 Merge pull request #4 from Adriankf59/devin/1777135879-phase-5-llm-hybrid
Phase 5: hybrid LLM extraction (Ollama) for header gaps
2026-04-26 03:20:12 +07:00
Adrian Kuman FirmansahandGitHub d4c85ba624 Merge pull request #5 from Adriankf59/devin/1777147640-phase-6-hitl
Phase 6: HITL review endpoints + audit trail
2026-04-26 03:19:54 +07:00
Adrian Kuman FirmansahGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>adrian kuman firmansah
812ea7e030 Merge pull request #1 from Adriankf59/devin/1777129396-phase-2-document-detection
Adds OpenCV-based phone-photo handling that runs before the standard
preprocessing pipeline for IMAGE source kinds (PDF renders are flat by
construction and skip this stage).

Pipeline additions in src/ocr_sprint/pipeline/document_detect.py:
- _find_document_quad: Canny + dilate + contour search, picks the
  largest convex 4-point polygon above a configurable area threshold;
  fails gracefully and returns None when no usable quad is found.
- _four_point_warp: orders corners (TL/TR/BR/BL via sum/diff trick)
  and runs cv2.getPerspectiveTransform + warpPerspective.
- _remove_shadow: per-channel background-division (dilate + median
  blur + 255 - absdiff + normalize) for uneven phone-shot lighting.
- detect_and_correct: top-level entrypoint with graceful fallback
  to the original image when detection fails.

Wired into the synchronous orchestrator: only enabled for IMAGE
sources, skipped for PDF. New settings:
- preprocess_detect_document (default: true)
- preprocess_remove_shadow (default: true)
- preprocess_min_quad_area_fraction (default: 0.20)

Tests: 9 new unit tests covering corner ordering, quad detection on
synthetic skewed documents, perspective warp output sanity, shadow
removal shape preservation, full-pipeline behavior, and graceful
fallback when detection fails. 70 tests total, all green.

ML-based dewarping (DewarpNet) and DocTR detector are deferred to a
future phase per the roadmap; the existing API is structured so they
can be added as alternative backends behind DocumentDetectConfig.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: adrian kuman firmansah <adriancuman@gmail.com>
2026-04-25 22:08:36 +07:00