How to detect vehicle license plates in photos in PHP

Let’s look at a super easy way to detect license plates in photographs. Our API will not only give the location and dimensions of the license plate (or plates) in question, but also give us the text of the plate and a confidence level for that text. Let’s dive in.

Image for post
Image for post

First we will run this command in our Composer command line:

composer require cloudmersive/cloudmersive_imagerecognition_api_client

Then it’s as simple as calling the recognizeDetectVehicleLicensePlates function:

require_once(__DIR__ . '/vendor/autoload.php');

And our output will look something like this:

"Successful": true,
"DetectedLicensePlates": [
"LocationX": 290,
"LocationY": 341,
"Width": 186,
"Height": 81,
"LicensePlateText_BestMatch": "ALPINE",
"LicensePlateText_RunnerUp": "BALPINE",
"LicensePlateRecognitionConfidenceLevel": 0.819610395703125
"DetectedLicensePlateCount": 1


There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store