Overview
In Bangladesh, millions of retail pharmacies, grocery shops, and small businesses still maintain their primary credit ledger (baki khata) on physical paper notebooks. Manual transcription into accounting software or spreadsheets takes hours each week and frequently introduces calculation errors.
Khata2Sheet AI is an open-source, local-first document processing engine that takes a mobile photo or scan of a traditional Bengali ledger page, rectifies lighting and perspective skew, extracts row-level transaction records, and exports clean, validated tabular data into CSV, Excel, or Google Sheets.
Architecture & Processing Pipeline
- Perspective Rectification: Scanned pages are rarely flat. The pipeline uses OpenCV to detect document boundaries, compute the homography matrix, and warp the image into an orthogonal 300 DPI flat plane.
- Adaptive Binarization: Traditional retail notebooks use varied ink colors (blue ballpoint, red ink, pencil) on low-grade paper. Adaptive thresholding separates ink strokes from paper fiber noise.
- Column Segmentation: Spatial clustering groups text tokens into Date, Customer Name, Description, Debit, Credit, and Balance columns.
- Bengali Numeral Normalization: Converts Bengali digits (০-৯) to standard numeric types, computes running balances, and verifies arithmetic consistency across rows.
Why Local-First Matters
Small business financial data is sensitive. Uploading unredacted customer debt lists to public cloud vision APIs compromises merchant privacy and incurs per-page billing costs. Running the pipeline entirely on local hardware guarantees zero data leakage and $0 ongoing software costs.