Skip to main content

Automatic license plate recognition using YOLOv8 and EasyOCR, with ROI filtering, FIFO output, and screenshot support.

Project description

ParkOCR

ParkOCR is a Python library for automatic license plate recognition using YOLOv8 for detection and EasyOCR for text recognition.
It is designed to work with RTSP streams (e.g., IP cameras), webcams, or video files.

✨ Features

  • YOLOv8 for plate localization (supports n, s, m, l, x models).
  • EasyOCR for text extraction.
  • ROI filtering: only detect plates inside a defined region.
  • Headless mode (no window display).
  • Prevents freezing on the same consecutive plate.
  • Optional FIFO output for inter-process communication.
  • Screenshot saving:
    • screenshot=None: disabled
    • screenshot="full": saves full frame
    • screenshot="roi": saves only the region of interest

📦 Installation

pip install parkocr

🚀 Usage

Basic example

from parkocr.detector import Detector

detector = Detector(
    rtsp_url="rtsp://user:password@192.168.0.100:554/onvif1",
    model_size=0,  # 0=nano, 1=small, 2=medium, 3=large, 4=xlarge
    headless=True,
    screenshot="roi",  # options: None, "full", "roi"
)

detector.run()

With FIFO output

detector = Detector(
    rtsp_url="rtsp://user:password@192.168.0.100:554/onvif1",
    fifo_output="/tmp/plates_fifo",
    headless=True
)
detector.run()

Now another process can read detected plates from /tmp/plates_fifo.

With callback

def on_plate(plate):
    print("Detected plate:", plate)

detector = Detector(
    rtsp_url="rtsp://user:password@192.168.0.100:554/onvif1",
    on_detect=on_plate,
    headless=True
)
detector.run()

⚙️ Parameters

  • rtsp_url (str): RTSP stream, file path, or webcam index.
  • model_size (int): 0=n, 1=s, 2=m, 3=l, 4=x. Larger = more accurate, slower.
  • conf_thresh (float): YOLO detection confidence threshold.
  • roi (tuple[int, int, int, int] | None): Region of interest (x1, y1, x2, y2). Defaults to central ROI.
  • headless (bool): Disable display windows and overlays.
  • window_size (tuple[int, int]): Window size for display.
  • process_interval_s (float): Seconds between detection cycles.
  • freeze_seconds (float): How long to freeze the display after detection.
  • ocr_langs (list[str]): OCR languages for EasyOCR.
  • on_detect (callable): Callback called with detected plate text.
  • min_ocr_conf (float): Minimum OCR confidence.
  • fifo_output (str | None): Path to FIFO file to send plates.
  • screenshot (str | None): None, "full", or "roi".

📂 Project structure

parkocr/
├── detector.py
├── __init__.py
README.md
pyproject.toml

📝 License

MIT © 2025 João Luiz Thomazetti

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parkocr-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parkocr-0.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file parkocr-0.1.1.tar.gz.

File metadata

  • Download URL: parkocr-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for parkocr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7e4795853255baa58202daf663af4548bc5576d6504b20d1b89fd15375c2f1f9
MD5 7618191b19d275bf11f050e1d5f83126
BLAKE2b-256 64292fdd8fcb6475186da11f4b9419f5c967f4d0b7b9a6de8f3caa2928937b6d

See more details on using hashes here.

File details

Details for the file parkocr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: parkocr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for parkocr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc55fa2d7cd9eb2f405c1ca4d58a6162e1ee857b1eace112195676e4be8df07
MD5 0b77f251453f63079009b81e1aa25e57
BLAKE2b-256 bf46c355c2c5cc20cc1ca399ac5ae23d81aaf63532e2b9c8edac16613dffd006

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page