Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intelligent OCR Document Digitization System

End-to-end intelligent OCR system built with OpenCV, Tesseract, spaCy, and scikit-learn. Features robust photo preprocessing, named entity recognition, and mathematical text summarization without relying on GPU acceleration or external APIs.


🛠️ Tech Stack

Computer Vision: OpenCV, Tesseract OCR
NLP: spaCy, scikit-learn
Frontend: Streamlit
Core: Python, NumPy, Pillow


✨ Features

  • Smart Document Detection: Automatically detects document boundaries and applies perspective transform to deskew the document.
  • Image Enhancement Pipeline: Handles grayscale conversion, denoising, adaptive thresholding, and morphological operations to clean up noisy images.
  • Lighting / Shadow Correction: Compensates for uneven lighting conditions often found in mobile scans.
  • Layout Analysis: Segments headings, paragraphs, and tables using layout detection algorithms.
  • Multi-language OCR: Extracts text in multiple languages via Tesseract OCR with customizable page segmentation modes.
  • Confidence Visualization: Displays a per-word confidence overlay using a traffic-light color system (Green/Yellow/Red).
  • Export Options: Download extracted text as plain TXT, structured JSON, or searchable PDF.
  • Batch Processing: Process multiple images at once and download a summary report.

Prerequisites

Before running the app, you need to install Tesseract OCR on your system:

  • macOS (using Homebrew):
    brew install tesseract
    brew install tesseract-lang
  • Ubuntu / Debian:
    sudo apt install tesseract-ocr
    sudo apt install tesseract-ocr-all
  • Windows: Download the installer from UB-Mannheim/tesseract and install. Add the installation path to your system's PATH.

Installation

  1. Clone or Download the Repository
  2. Create a Virtual Environment (recommended):
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. Install Dependencies:
    pip install -r requirements.txt

Usage

Run the Streamlit application:

streamlit run main.py

The app will open automatically in your browser (usually at http://localhost:8501).

Settings Panel

The sidebar provides various configuration options:

  • Preprocessing: Toggle automatic document detection, lighting correction, and morphological cleanup.
  • OCR Settings: Select the target language and Tesseract Page Segmentation Mode (PSM).
  • Display Options: Toggle intermediate step visualizations like the layout regions and word-level confidence maps.
  • Mode: Switch between "Single Image" and "Batch Processing".

📁 Project Structure

intelligent-ocr-digitalization/
├── main.py                     # Streamlit web application entry point
├── src/
│   ├── ocr_engine.py          # Core OCR processing pipeline
│   ├── preprocessing.py        # Image enhancement and document detection
│   ├── layout_analysis.py      # Region segmentation (headings, paragraphs, tables)
│   ├── exporters.py           # TXT/JSON/PDF export handlers
│   └── utils.py               # Helper functions and visualization
├── requirements.txt           # Python dependencies
└── README.md

🎯 Use Cases

  • Document Digitization: Convert physical receipts, contracts, and forms into searchable text
  • Batch Processing: Process large volumes of scanned documents automatically
  • Multi-language Support: Extract text from documents in various languages
  • Quality Assessment: Confidence scoring helps identify text regions that need manual review
  • Accessible Archives: Generate searchable PDFs from image-based documents

🚀 Future Enhancements

  • Add deep learning-based text detection (EAST/CRAFT)
  • Integrate table structure recognition
  • Support handwriting recognition
  • Add document classification pipeline
  • Export to structured formats (CSV for tables)

📸 Screenshots

Coming soon: Dashboard UI, confidence visualization, and before/after processing examples


🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


📄 License

MIT License - feel free to use this project for learning or commercial purposes.

About

End-to-end Intelligent OCR system built with OpenCV, Tesseract, spaCy, and scikit-learn. Features robust photo preprocessing, named entity recognition, and mathematical text summarization without relying on GPU acceleration or external APIs.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages