Skip to content

sampriti-gopisetti/Automated-Number-Plate-Detection

Repository files navigation

Automated Number Plate Detection (ANPR)

End-to-end number plate text extraction for Indian vehicles using OpenCV and Tesseract OCR.

ANPR

What it does

  • Preprocesses the image (blur, grayscale, Sobel, morphology)
  • Detects candidate plate regions via contours and geometric filtering
  • Cleans plate ROI and applies Tesseract OCR
  • Prints the extracted alphanumeric number plate text

Example output:

Extracted Number Plate Text: KA05MN1234

Requirements

Python packages are listed in requirements.txt:

  • numpy
  • opencv-python
  • pillow
  • pytesseract
  • matplotlib (only if you use --visualize)

Quick start (Windows)

  1. Create and activate a virtual environment
py -m venv .venv
.venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Install Tesseract OCR (if not already installed)
  • Download and install for Windows.
  • If tesseract.exe is not on your PATH, pass its location with --tesseract-cmd.
  1. Run on a sample image
python Program.py --image Dataset\7.jpeg --tesseract-cmd "C:\\Program Files\\Tesseract-OCR\\tesseract.exe"

Optional: see intermediate processing steps

python Program.py --image Dataset\7.jpeg --visualize --tesseract-cmd "C:\\Program Files\\Tesseract-OCR\\tesseract.exe"

Notes

  • frontend.html is a static demo page; it doesn’t run OCR in the browser. Use Program.py for detection.

Project structure

  • Program.py – CLI script to run ANPR on an image
  • Dataset/ – sample images
  • Search_Image/Car.jpeg – demo image used by the static frontend
  • frontend.html – static landing page (no backend)
  • requirements.txt – Python dependencies

Troubleshooting

  • Tesseract not found: Install it and/or provide --tesseract-cmd.
  • Empty result: try a higher quality image or run with --visualize to inspect steps.
  • OpenCV errors on reading image: verify path and file extension.

Contributing

PRs are welcome. Please include a brief description and sample image if relevant.

License

See LICENSE file.


How to publish this to your GitHub (MNSamarth/Automated Number Plate Detection)

Replace square-bracket placeholders with your own if needed.

  1. Initialize the repository (run in the project folder)
git init
git add .
git commit -m "Initial commit: ANPR CLI, README, requirements"
  1. Create the GitHub repo
  • Go to https://github.com/new and create a repository named:
    • Automated Number Plate Detection
  • Or via CLI (requires gh):
gh repo create "MNSamarth/Automated Number Plate Detection" --public --source . --remote origin --push
  1. If you created the repo in the browser, set the remote and push
git remote add origin https://github.com/MNSamarth/Automated-Number-Plate-Detection.git
git branch -M main
git push -u origin main

If your repository slug contains spaces, GitHub will normalize it with dashes. Verify the exact URL after creation and update the git remote add origin URL accordingly.

  1. Verify on GitHub
  • Open the repo page and confirm files are present and README renders.

References

About

A command-line tool to detect and extract text from Indian vehicle number plates using Python, OpenCV, and Tesseract OCR.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published