Skip to main content

openbharatocr

Build status

openbharatocr is a Python library developed as open-source, designed specifically for optical character recognition (OCR) of Indian government documents.

The features of this package:

  • It offers comprehensive support for the majority of Indian government documents, covering a wide range of document types.

Setting Up a Development Environment for OpenBharatOCR

This guide details how to establish a development environment for OpenBharatOCR on a Linux system (Ubuntu/Debian preferred). If you're using Windows or macOS, consider using a virtual machine or a Linux subsystem (WSL2 on Windows, Docker on macOS).

Prerequisites:

  • Operating System: Linux (Ubuntu/Debian preferred)
  • Python 3.6 or later: Check the version with python3 --version or python --version in your terminal. Download the latest installer from https://www.python.org/downloads/ if needed.

Installation:

  • Clone the openbharatocr repository:
git clone https://github.com/essentiasoftserv/openbharatocr.git
  • Create a virtual environment (recommended):

    This isolates project dependencies and avoids conflicts with system-wide packages. Use venv or virtualenv (if venv is not available):

    python3 -m venv openbharatocr_env  # Using venv
    # OR
    virtualenv openbharatocr_env      # Using virtualenv
  • Activate the virtual environment:
source openbharatocr_env/bin/activate  # For venv
# OR
source openbharatocr_env/bin/activate  # For virtualenv
  • Install dependencies: Navigate to the cloned repository directory and install required packages using pip:
    cd openbharatocr
    pip install -r requirements.txt

Installation

    pip install openbharatocr

Pan Card

This function takes the path of a PAN card image as input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.pan(image_path)

Aadhaar Card

The two functions accepts the file paths of the front and back images of an Aadhaar card as input and returns their corresponding information encapsulated in a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.front_aadhaar(image_path)
    dict_output = openbharatocr.back_aadhaar(image_path)

Driving Licence

This function takes the path of a Driving Licence card image as input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.driving_licence(image_path)

Passport

This function takes the path of a Passport image as input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.passport(image_path)

VoterID

The two functions accepts the file paths of the front and back images of a voterID as input and returns their corresponding information encapsulated in a dictionary.

    import openbharatocr 
    # Download YOLOv3 models from links(added below) and set local downloaded path to YOLO_CFG, YOLO_WEIGHT env variables
    dict_output = openbharatocr.voter_id_front(image_path)
    dict_output = openbharatocr.voter_id_back(image_path)

Download Resources

Some resources need to be downloaded and set the path in the variables.

Vehicle Registration Card/Certificate

This function takes the path of a Vehicle Registration Card/Certificate image as an input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.vehicle_registration(image_path)

Water Bill

This function takes the path of a Water Bill image as an input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.water_bill(image_path)

Birth Certificate

This function takes the path of a Birth Certificate image as an input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.birth_certificate(image_path)

Degree

This function takes the path of a Degree image as an input and returns its information in the form of a dictionary.

    import openbharatocr 
    dict_output = openbharatocr.degree(image_path)

Contribute & support

We are so pleased to your help and help you. If you wanna develop openbharatocr, Congrats! If you have problem, don't worry, create an issue here:

    https://github.com/essentiasoftserv/openbharatocr/issues

Pre Commit

Note: Before committing your changes, run pre-commits

    pre-commit run --all

Metadata

Release files for openbharatocr 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openbharatocr 0.4.3
File Size Uploaded Provenance
openbharatocr-0.4.3.tar.gz 34.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openbharatocr 0.4.3
File Interpreter ABI Platform
openbharatocr-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 76.9 kB

Release files / openbharatocr-0.4.3.tar.gz

Download URL openbharatocr-0.4.3.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d75a6fff4c7d84d033718da2108f3b8bf58faa69032076d781ef0c3ed331db99
BLAKE2b-256 checksum
How to use checksums
9551fe654e12da2e967549544aed2f4d35c58b600351b5a88ba042141655c90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / openbharatocr-0.4.3-py3-none-any.whl

Download URL openbharatocr-0.4.3-py3-none-any.whl
Size 42.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39ed4a3fa12012f6a252ce603c8d953b1e9ed390794a1cec4677e3d34e771052
BLAKE2b-256 checksum
How to use checksums
c4cb9869232b8f089710561f31eb5c74ace387ba2ec52cecd84235298105735b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for openbharatocr 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page