Skip to main content

License Plate Recognition Camera API (LPR/ALPR)

Viewtron AI security cameras include built-in license plate recognition (LPR/ALPR) that runs entirely on the camera hardware — no cloud service, external software, or third-party LPR engine required. When a vehicle passes through the camera's detection zone, the camera reads the license plate and sends an HTTP POST webhook to your server with the plate number, a cropped plate image, and (on NVR v2.0) detailed vehicle attributes including type, color, brand, and model.

The API also supports managing an on-camera plate database with whitelist and blacklist entries, enabling automated gate access control without any middleware. Plates can be added with date ranges and owner information. The camera includes a Wiegand output for direct integration with gate controllers and access control panels. All Viewtron IP cameras and NVRs are NDAA compliant.

What You Can Build

  • Automated gate access control — open gates and barriers when whitelisted plates are detected, using Wiegand output or webhook-triggered relay
  • Vehicle access logs — record every plate read with timestamp, plate image, and authorization status for parking garages, gated communities, or corporate campuses
  • Visitor management systems — pre-register expected visitor plates with date ranges using AddLicensePlates, automatically grant access on arrival
  • Blacklist alerting — receive instant notifications when a blacklisted plate is detected on property
  • Fleet tracking — monitor arrival/departure times for company vehicles across multiple camera locations
  • Law enforcement integration — feed plate reads into stolen vehicle databases or BOLO systems in real time
  • Parking enforcement — detect unauthorized vehicles and trigger alerts or record violations with plate crop images

How It Works

  1. Install an LPR camera at the vehicle entry point — position the camera to capture plates at the correct angle and distance
  2. Configure LPR detection on the camera — set the plate region (U.S.A, Canada, Europe, etc.), sensitivity, and detection zone
  3. Enable HTTP POST webhooks — point the camera or NVR at your server's IP and port
  4. Manage the plate database (optional) — add plates to the whitelist or blacklist using the AddLicensePlates API with owner info
  5. Your server receives XML when a plate is read — the POST includes the plate number, plate group status, plate crop image, and vehicle attributes
  6. Parse the event using the Viewtron Python SDK (pip install viewtron) or raw XML parsing in any language
  7. Take action — log the plate read, trigger a gate relay, send alerts, or update your database

Event Data

Each LPR webhook POST contains:

FieldDescription
smartTypeVEHICE (IPC) or vehicle (NVR)
plateNumber / licensePlateNumberDetected plate text (e.g., JP116D)
vehicleListTypeIPC: whiteList, blackList, temporaryList, or absent if not in database
licensePlateMatchInfo/groupNameNVR: user-defined group name (e.g., "Whitelist", "Residents"), or absent if not in database
licensePlateAttribute/colorPlate color (NVR v2.0)
carAttribute/carTypeVehicle type: sedan, suv, mpv, truck, etc. (NVR v2.0)
carAttribute/colorVehicle color (NVR v2.0)
carAttribute/brandVehicle brand: GMC, Ford, Toyota, etc. (NVR v2.0)
carAttribute/modelVehicle model: GMC_SAVANA, etc. (NVR v2.0)
rectPlate bounding box coordinates (x1, y1, x2, y2)
targetBase64DataCropped plate JPEG image (base64 encoded, ~10-20 KB)
sourceBase64DataFull-frame overview JPEG image (base64 encoded, ~400-500 KB)
currentTimeDetection timestamp

Parsing LPR Events

The simplest way to receive LPR events. The SDK's ViewtronServer handles HTTP connections, keepalives, XML parsing, and version detection — you just write the callback:

pip install viewtron
from viewtron import ViewtronServer
import os

IMG_DIR = "images"
os.makedirs(IMG_DIR, exist_ok=True)

def on_event(event, client_ip):
if event.category != "lpr":
return

plate = event.get_plate_number()
group = event.get_plate_group() # "whiteList", NVR group name, or ""
print(f"Plate: {plate} | Group: {group or 'Unknown'}")

# Save plate crop image
plate_jpg = event.get_target_image_bytes()
if plate_jpg:
with open(f"{IMG_DIR}/{plate}.jpg", "wb") as f:
f.write(plate_jpg)

# NVR v2.0 includes vehicle attributes
if event.get_alarm_type() == "vehicle":
print(f" Vehicle: {event.get_car_brand()} {event.get_car_model()}")

server = ViewtronServer(port=5002, on_event=on_event)
server.serve_forever()

See the Python SDK reference for the full list of methods and event classes.

Managing the Plate Database

The LPR camera maintains an on-device plate database. Use the Viewtron Python SDK or the raw API to manage plates:

from viewtron import ViewtronCamera

camera = ViewtronCamera("192.168.0.20", "admin", "password")

# Add a plate to the allow list
camera.add_plate("ABC1234")

# Query the database
plates = camera.get_plates()
for plate in plates:
print(plate["plate_number"], plate["owner"])

# Update plate details
camera.modify_plate("ABC1234", owner="Mike", telephone="555-1234")

# Remove a plate
camera.delete_plate("ABC1234")

See the LPR Config API reference for the complete plate database API including ModifyLicensePlate and DeleteLicensePlate.

Relevant API Endpoints

EndpointPurposeReference
GetSmartVehicleConfigRead LPR detection settings (sensitivity, region, dedup mode)LPR Config
AddLicensePlatesAdd plates to the databaseLPR Config
GetLicensePlatesQuery the plate database with paginationLPR Config
ModifyLicensePlateUpdate plate details (owner, phone)LPR Config
DeleteLicensePlateRemove a plate from the databaseLPR Config
SetHttpPostConfigConfigure webhook destinationWebhook Config
GetAlarmStatusPoll current alarm stateAlarm Status
Wiegand Output for Gate Access

Viewtron LPR cameras include a Wiegand output that sends the plate number directly to gate controllers and access control panels. This works independently of the HTTP API — the camera can simultaneously send Wiegand signals to a gate controller and HTTP POST webhooks to your software.

Integrations

Viewtron LPR cameras also integrate with automation platforms via published packages:

PlatformPackageWhat It Does
Home Assistantviewtron-home-assistantPlate reads + images as native HA sensors via MQTT — automate gates, lights, alerts
Node-REDnode-red-contrib-viewtronPlate reads direct to Node-RED flows — no middleware needed

Video Guides

Questions & Development Inquiries

Mike Haldas is available for questions, consultation, and custom software development for Viewtron API related projects. Email details about your project to mike@viewtron.com.