Skip to main content

PlateRecognizePy

PlateRecognizePy is a Python library for license plate detection and recognition, with special support for Indian number plates. It provides a simple interface to process images containing license plates and extract the plate text.

Features

  • License plate detection in images using YOLOv8 (with OpenCV as fallback)
  • Text recognition from license plates
  • Support for both Tesseract OCR and EasyOCR
  • Configurable output saving and directory
  • Logging of detection and recognition results
  • Specialized support for Indian number plates:
    • Recognition of both white and yellow plates
    • Handling of various Indian state codes
    • Support for both new and old format Indian plates

Installation

You can install PlateRecognizePy using pip:

pip install PlateRecognizePy

Requirements

PlateRecognizePy requires Python 3.7 or later. The main dependencies are:

For a complete list of dependencies, please refer to the setup.py file.

Usage

Here's a simple example of how to use PlateRecognizePy:

from plate_recognize_py import process_license_plate
import cv2

# Load an image
image = cv2.imread('path/to/your/image.jpg')

# Process the image
config = {
    'save_output': True,
    'output_dir': 'custom_output'
}
license_plate, text = process_license_plate(image, config)

print(f"Detected license plate: {text}")

The process_license_plate function now accepts an optional config dictionary with the following options:

  • save_output: Boolean to control whether to save the output images (default: True)
  • output_dir: String specifying the directory to save output images (default: 'output')

For more detailed examples and the full source code, you can check out the License plate recognition Python.

Indian Number Plate Recognition

PlateRecognizePy is optimized for Indian number plates:

from plate_recognize_py import process_indian_license_plate
import cv2

# Load an image with an Indian number plate
image = cv2.imread('path/to/indian_plate_image.jpg')

# Process the image
license_plate, text, state = process_indian_license_plate(image)

print(f"Detected license plate: {text}")
print(f"State: {state}")

This function works for both white and yellow Indian number plates, automatically detecting the plate color and adjusting the recognition process accordingly.

Indian Number Plate Formats

PlateRecognizePy supports various Indian number plate formats:

  1. New Format: AA 00 AA 0000 Example: DL 01 CA 1234

  2. Old Format: AA AA 0000 Example: MH 12 3456

  3. Commercial Vehicle Format: AA 00 A 0000 Example: HR 55 C 7890

The library automatically detects the format and processes it accordingly.

Supported Indian State Codes

PlateRecognizePy recognizes all Indian state codes, including but not limited to:

  • DL: Delhi
  • MH: Maharashtra
  • KA: Karnataka
  • TN: Tamil Nadu
  • UP: Uttar Pradesh

Contributing

Contributions to PlateRecognizePy are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • OpenCV for image processing capabilities
  • Tesseract and EasyOCR for text recognition
  • YOLOv8 for object detection

PlateRecognizePy is developed by VJ. For any questions or support, please open an issue on the GitHub repository or reach out on X (Twitter) @saidbyvj.

Performance and Accuracy

PlateRecognizePy has been tested on a wide range of Indian number plates, including:

  • High-resolution images
  • Low-light conditions
  • Angled or skewed plates
  • Partially obscured plates

In optimal conditions, the library achieves an accuracy rate of over 95% for Indian plates.

Limitations

While PlateRecognizePy performs well in most scenarios, users should be aware of some limitations:

  • Extremely blurry or low-resolution images may yield inaccurate results
  • Severely damaged or heavily customized plates might not be recognized correctly
  • The library may struggle with non-standard fonts or highly stylized plates

Future Improvements

We are continuously working to improve PlateRecognizePy, with planned enhancements including:

  • Support for more international license plate formats
  • Integration with more advanced OCR technologies
  • Performance optimizations for faster processing

Metadata

Release files for PlateRecognizePy 0.2.2

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

Source distribution (sdist)

Source distribution for PlateRecognizePy 0.2.2
File Size Uploaded
platerecognizepy-0.2.2.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 11.0 kB

Release files / platerecognizepy-0.2.2.tar.gz

Download URL platerecognizepy-0.2.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
80d2bd612ede8b5123bcf8fa2c5df1f9805feca1cb0619b8c4a6b665de79d289
BLAKE2b-256 checksum
How to use checksums
b1b6c70cb301ccca87e17deed7678ddea00867bbaf69b7b6356212d20c7650ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / PlateRecognizePy-0.2.2-py3-none-any.whl

Download URL PlateRecognizePy-0.2.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5872a29a3d5e00a1d84bb26d832e760d01fac7207d48e5acc546dcebb70c5222
BLAKE2b-256 checksum
How to use checksums
aaa3463de0b2bee2914f1a7f8e39d2158bc2845c58cd649ace8b5b3e9bede580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

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