VisioForge

License plate recognition (ANPR/LPR) in C# and .NET

Read vehicle license plates from IP cameras, webcams and video files in C#. LicensePlateRecognizerBlock finds each plate, reads it and reports the text with a timestamp — on the device, in the same pipeline that previews, records and streams the video.

A plate reader is not general OCR pointed at a car

Automatic number plate recognition — ANPR, also called ALPR, LPR or licence plate recognition — is not general OCR. General OCR reads every sign, sticker and logo in the frame and does not know which text is the plate. ANPR needs two models: a detector that finds plates and an OCR model trained on plate characters. You also need the frames — decoded from the camera, picked at a rate the hardware can keep up with, without stalling the live video. In VisioForge SDKs, LicensePlateRecognizerBlock is a block of the video pipeline: the SDK decodes the source, the block runs both models on a background thread, and the frames continue to the screen, a file or a network stream.

Building ANPR yourself or calling a cloud API vs. LicensePlateRecognizerBlock

Typical do-it-yourself or cloud ANPRLicensePlateRecognizerBlock in a VisioForge pipeline
Finding the plateFind or train a plate detector, export it to ONNX, write the pre- and post-processingFastALPR YOLOv9-T plate detector (MIT); DetectionConfidenceThreshold and MaxDetections
Reading the charactersGeneral OCR that also reads every other text in the frameA plate-specific fast-plate-ocr head; Text comes uppercased, with non-alphanumeric characters removed
Getting frames from the cameraA separate decoder or frame grabber for each kind of sourceAny SDK source: RTSP IP cameras, webcams, video files
Keeping live video smoothRecognition on the capture thread stalls the streamRecognition runs on a background worker; frames that arrive while it is busy are skipped and counted
Plates from different countriesRetrain the model or change providerA global head for the USA and 90+ countries and a European head for EU plates, chosen with RecognitionModelPath
Where the video goesFrames sent to a cloud service and billed per callNowhere: ONNX Runtime in your process, no API key, no per-call fee

What the ANPR block gives you

LicensePlateRecognizerBlock ships in the VisioForge.DotNet.Core.AI package. It has one video input and one video output, runs two ONNX models on the frames it receives and reports plates through the OnPlateRecognized event.

  • Two-stage recognition: a YOLOv9-T detector finds the plates, and each cropped plate is read by a plate-specific OCR model; both are FastALPR models under the MIT license
  • A full result per plate: Text, Confidence (0 to 1), BoundingBox and the four-point Polygon in source-frame pixels, with the frame Timestamp on every event
  • Regional heads: the global head covers the USA and 90+ countries, the European head is tuned for EU plates; both read Latin characters (digits and A–Z), and the input size is read from the model itself
  • On the device: ONNX Runtime with DirectML on Windows GPUs, CoreML on Apple platforms and the CPU as fallback; ActiveProvider tells you which one is in use
  • Live video stays smooth: recognition runs on a background worker, FramesToSkip sets how often it runs, and LastInferenceTimeMs and DroppedFrameCount show how the hardware keeps up
  • Recognition next to recording: DrawResults draws the plate boxes and text into the frames that go on to the preview, a file or a stream
  • One block for every engine: connect it in a Media Blocks SDK .NET pipeline, or add it with Video_Processing_AddBlock to VideoCaptureCoreX or MediaPlayerCoreX

Where it is used

Parking access and payment

Recognize the plate at a gate camera to open the barrier or start a parking session.

Toll and access-control logging

Record which plates passed a fixed camera and when, with the video kept on site.

Fleet and yard management

Track vehicles entering and leaving a private lot or depot.

Traffic review tooling

Flag plates for manual review; final enforcement decisions should always include a human check.

Code Examples

Built from the License Plate Recognition Demo, which ships the three FastALPR model files; the second example adds the block to VideoCaptureCoreX the way the Capture OCR X demo adds its AI block.

Log the plates from a gate camera

C#

Preview an IP camera, list the plates and record to MP4

C#

Pipeline

In the gate example LicensePlateRecognizerBlock sits between the camera and a null renderer. Plates leave through the OnPlateRecognized event; with DrawResults on, the frames carry the boxes and text to whatever block comes next.

RTSPSourceBlock
LicensePlateRecognizerBlock
NullRendererBlock

Frequently Asked Questions

Does the video leave the machine?▼
No. LicensePlateRecognizerBlock runs both models with ONNX Runtime inside your process. There is no cloud service and no API key; frames and plate numbers stay on the device. The models are two .onnx files you ship with your application.
Which countries' plates can it read?▼
The FastALPR global recognition head covers the USA and 90+ countries; a separate European head is tuned for EU plates. Point RecognitionModelPath at the head for your region; the detector is the same for both.
Do I need to train my own model?▼
No. The block uses the FastALPR YOLOv9-T detector and the fast-plate-ocr recognition head as they are; you only supply the two .onnx files. They ship with the License Plate Recognition Demo.
What about busy scenes with many vehicles or distant plates?▼
The block reports up to MaxDetections plates per frame (10 by default). For small or distant plates, lower DetectionConfidenceThreshold or give the camera a closer view. On very busy scenes, a vehicle detector such as YOLOObjectDetectorBlock upstream can crop the vehicles first.
Which SDK do I need?▼
LicensePlateRecognizerBlock is in the VisioForge.DotNet.Core.AI package. Use it in a Media Blocks SDK .NET pipeline when you build the pipeline yourself, or add it with Video_Processing_AddBlock to VideoCaptureCoreX in Video Capture SDK .NET or to MediaPlayerCoreX in Media Player SDK .NET when your app already uses one of those engines.
Are license plates personal data?▼
Plates are commonly treated as personal data under privacy regulations such as the GDPR, and some jurisdictions have their own ANPR rules; review them for your use case before you deploy. To hide plates in a recording instead of reading them, PIIRedactionBlock blurs or pixelates them with the same plate detector.