Skip to content

Atharvashind/OCR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Marathi OCR Recognition & Translation System

Project Overview

This project implements an Optical Character Recognition (OCR) pipeline for Marathi-language PDF documents using Tesseract OCR and PyTesseract. The system extracts Marathi text from scanned or image-based PDFs and translates it into English using Google Translate, enabling easy understanding and further analysis.

This solution is especially useful for digitizing regional-language documents such as government records, academic documents, and historical archives.


Key Features

  • PDF to image conversion
  • Marathi text recognition using Tesseract OCR
  • Marathi Tesseract language model (mar)
  • Translation from Marathi to English using Google Translate
  • Clean and structured text extraction
  • Works with scanned and image-based PDFs

Technologies Used

  • Python
  • Tesseract OCR
  • PyTesseract
  • Marathi Tesseract Language Pack (mar.traineddata)
  • pdf2image
  • Pillow (PIL)
  • Google Translate (API / googletrans library)

Project Workflow

  1. Input Marathi PDF document
  2. Convert PDF pages to images using pdf2image
  3. (Optional) Image preprocessing for better OCR accuracy
  4. Extract Marathi text using PyTesseract (lang="mar")
  5. Clean OCR output text
  6. Translate Marathi text into English using Google Translate
  7. Store translated text in text files or structured format

Installation & Setup

1 Clone the Repository

git clone https://github.com/your-username/marathi-ocr-translation.git
cd marathi-ocr-translation

2 Install Python Dependencies

pip install pytesseract pdf2image pillow googletrans==4.0.0-rc1

3 Install Tesseract OCR

Ubuntu / Linux

sudo apt install tesseract-ocr
sudo apt install tesseract-ocr-mar

Windows

  1. Download Tesseract from: https://github.com/UB-Mannheim/tesseract/wiki

  2. Add Tesseract to system PATH

  3. Download mar.traineddata and place it in:

    tessdata/
    

Usage Example

from pdf2image import convert_from_path
import pytesseract
from googletrans import Translator

translator = Translator()
images = convert_from_path("input.pdf")

for img in images:
    marathi_text = pytesseract.image_to_string(img, lang="mar")
    translated_text = translator.translate(marathi_text, src="mr", dest="en")
    print(translated_text.text)

Supported Languages

  • OCR Input Language: Marathi (mr)
  • Translation Output Language: English (en)

Limitations

  • OCR accuracy depends on scan quality and font clarity
  • Google Translate accuracy may vary for complex or domain-specific Marathi text
  • Handwritten Marathi text is not supported
  • Tables and multi-column layouts may require extra processing

Future Enhancements

  • Advanced image preprocessing
  • Layout and table detection
  • Offline translation support
  • Web interface using Flask or Streamlit
  • Batch processing for large datasets

Collaboration & Contributions

Contributions are welcome and encouraged!


Author

Atharva Shinde Marathi OCR | NLP | Document Digitization

🚀

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors