YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
SIH OCR Studio
High-Performance Windows Desktop Application for Offline Document OCR & Text Extraction
Powered by JavaFX 21, Python 3.12, Tesseract OCR v5, PyMuPDF, OpenCV, and FastAPI.
SIH OCR Studio provides an offline desktop experience for converting scanned images and multi-page PDF documents into editable, structured text with full support for Hindi (Devanagari), English, and bilingual Hindi+English documents.
๐ธ Key Capabilities & UI Layout
SIH OCR Studio implements a clean and high-performance desktop architecture:
+-----------------------------------------------------------------------------------------------+
| SIH OCR | Studio [Engine: Tesseract OCR] [Engine Loaded โ] [Lang: Hindi + English] |
| [๐ Open File] dh2efile.pdf [< Prev] [Page: 1/12] [Next >] [Zoom +/-] [Fit] [Rotate] |
+-----------------------------------------------+-----------------------------------------------+
| | Output: [Markdown] [HTML] [JSON] [Copy] |
| DOCUMENT PREVIEW | ------------------------------------------- |
| | OCR Result |
| โข High-fidelity rendering (PyMuPDF) | File: dh2efile.pdf |
| โข Interactive zoom, pan & rotation | Page: 1/12 | Lines: 18 | Words: 140 |
| โข Drag-and-drop file upload | Confidence: 94.8% |
| โข Image & PDF text-layer inspection | ------------------------------------------- |
| โข Multi-page navigation | เคคเคฎเคฟเคฒเคจเคพเคกเฅ เคเฅ เคฐเคพเคเคจเฅเคคเคฟ เคฎเฅเค เคธเคฐเคเคพเคฐ เคเค เคจ เคเฅ |
| | เคฒเฅเคเคฐ เคนเคฒเคเคฒ เคคเฅเคเคผ เคนเฅ เคเค เคนเฅ... |
+-----------------------------------------------+-----------------------------------------------+
| [โถ Run OCR] [โก OCR All Pages] [โน Stop] | [Copy Text] [Export DOCX] [Export TSV] |
| Time: 1.4s | Progress: [==========] 100% | [Export TXT] [Export JSON] [Export HTML] |
+-----------------------------------------------+-----------------------------------------------+
| Ready | Backend: Online โ (127.0.0.1:8000) |
+-----------------------------------------------------------------------------------------------+
Core Features:
- Offline & Private: All processing occurs locally on
127.0.0.1. No internet access required. No data leaves the machine. - Multilingual OCR Engine: Native Tesseract OCR integration with multi-script support:
- English (
eng) - Hindi (
hin) - Hindi + English (
hin+eng) - Dynamic detection of 160+ installed Tesseract language packs.
- English (
- Multi-Page PDF Processing:
- Fast page navigation and progressive on-demand page rendering at 150-300 DPI.
- Hybrid text-layer detection: instantly extract embedded digital text or perform full OCR.
- Sequential batch processing with cancellation checkpoints.
- Image Preprocessing Pipeline (OpenCV & Pillow):
- Automatic deskewing (rotational alignment).
- Noise reduction (bilateral filtering).
- Contrast enhancement (CLAHE).
- Adaptive thresholding (binarization).
- Upscaling for fine/small typography.
- Invert colors mode for dark background documents.
- Output Views & Formats:
- Markdown Tab: Clean readable plain text with preserved paragraphs and Devanagari Unicode.
- HTML Tab: Structured, safe semantic HTML output.
- JSON Tab: Word-level positions, line indices, bounding boxes, and confidence statistics.
- Export Formats:
- Microsoft Word (DOCX)
- Tab-Separated Values (TSV)
- Plain Text (TXT)
- Structured JSON
- Webpage (HTML)
- Markdown (MD)
๐ ๏ธ Technology Stack
| Layer | Component | Description |
|---|---|---|
| Frontend UI | JavaFX 21 | Native desktop UI, GPU-accelerated rendering, Segoe UI & Devanagari typography. |
| Build System | Maven 3.9 | Dependency management, JavaFX packaging, shaded fat JAR creation. |
| Backend Engine | Python 3.12 (FastAPI) | High-throughput asynchronous local service bound strictly to 127.0.0.1. |
| OCR Engine | Tesseract OCR v5.5 | Industrial OCR engine with neural network (LSTM) recognition. |
| PDF Processing | PyMuPDF (fitz) | High-fidelity rendering and vector text-layer extraction. |
| Image Pipeline | OpenCV & Pillow | Geometric correction, filtering, and thresholding. |
| Export Service | python-docx & csv | Native Microsoft Word DOCX and TSV generation. |
๐ Quick Start on Windows
1. One-Click Setup
Open PowerShell in the workspace root and run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\scripts\setup_windows.ps1
2. Launch the Desktop Application
Double-click run.bat or run in Command Prompt / PowerShell:
.\run.bat
Or via PowerShell script:
.\scripts\run_windows.ps1
3. Build & Package
To produce a standalone Windows package:
.\scripts\build_windows.ps1
๐ Local API Endpoints (127.0.0.1:8000)
The application uses an internal REST API for decoupled Java-to-Python communication:
GET /api/health: Health status, Tesseract availability, version, and language pack check.GET /api/languages: Dynamic list of available installed OCR languages.POST /api/document/info: Document inspection (type, format, dimensions, page count, text-layer presence).GET /api/document/preview: Render document page preview at specified DPI (PNG stream).POST /api/ocr: Submit OCR job (single page, multi-page, or text-layer auto).GET /api/jobs/{job_id}: Track progress (0.0 to 1.0, current page, elapsed time).GET /api/jobs/{job_id}/results: Retrieve completed OCR text, stats, and words metadata.POST /api/jobs/{job_id}/cancel: Request safe cancellation between pages.POST /api/export: Export results to DOCX, TSV, TXT, JSON, HTML, or MD.POST /api/settings/update: Dynamically update and re-test Tesseract executable path.
๐งช Automated Test Suite
Both backend and frontend components have comprehensive automated test suites:
1. Backend Pytest Suite
Run with:
.venv\Scripts\python.exe -m pytest backend/tests
Results: 8 passed in 4.71s
test_health_endpointtest_languages_endpointtest_document_processor_inspecttest_pdf_renderingtest_image_preprocessingtest_ocr_engine_executiontest_api_ocr_flowtest_exports(TXT, DOCX, TSV, JSON, MD, HTML)
2. Java Frontend Unit Tests
Run with:
.\tools\maven\bin\mvn.cmd test -f frontend/pom.xml
Results: Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
testAppSettingsDefaultstestDocumentInfoModeltestOcrResultSerialization(Unicode Hindi Devanagari serialization test)
๐ Project Structure
sih-ocr-studio/
โโโ README.md
โโโ run.bat
โโโ .gitignore
โโโ backend/
โ โโโ config.py
โ โโโ document_processor.py
โ โโโ export_service.py
โ โโโ image_preprocessing.py
โ โโโ main.py
โ โโโ ocr_engine.py
โ โโโ requirements.txt
โ โโโ result_formatter.py
โ โโโ tests/
โ โโโ test_backend.py
โโโ frontend/
โ โโโ pom.xml
โ โโโ src/
โ โโโ main/
โ โ โโโ java/com/sihocr/
โ โ โ โโโ Launcher.java
โ โ โ โโโ MainApp.java
โ โ โ โโโ controllers/
โ โ โ โ โโโ MainController.java
โ โ โ โโโ models/
โ โ โ โ โโโ AppSettings.java
โ โ โ โ โโโ DocumentInfo.java
โ โ โ โ โโโ OcrFullResult.java
โ โ โ โ โโโ OcrJobStatus.java
โ โ โ โ โโโ OcrPageResult.java
โ โ โ โโโ services/
โ โ โ โ โโโ BackendProcessManager.java
โ โ โ โ โโโ OcrApiClient.java
โ โ โ โโโ views/
โ โ โ โโโ AboutDialog.java
โ โ โ โโโ InstructionsDialog.java
โ โ โ โโโ SettingsDialog.java
โ โ โโโ resources/
โ โ โโโ css/
โ โ โโโ styles.css
โ โ โโโ dark.css
โ โโโ test/
โ โโโ java/com/sihocr/
โ โโโ ModelsAndSettingsTest.java
โโโ scripts/
โ โโโ build_windows.ps1
โ โโโ run_windows.ps1
โ โโโ setup_windows.ps1
โโโ docs/
โ โโโ INSTALLATION.md
โ โโโ TROUBLESHOOTING.md
โโโ tools/
โโโ jdk-21/
โโโ maven/