How to detect vehicle license plates in photos in Javascript

Cloudmersive
2 min readMar 13, 2020

--

A little license plate detection never hurt anyone, right? What about the hours of work required to set it up? Well that’s a thing of the past now. Forget all the Deep Learning and coding headaches. We have a full system for photo license plates already set up, all you need to do is use an API call.

Install the API client with this code snippet, which can be added between the head tags of your page or in your HTML file.

<script src="https://cdn.cloudmersive.com/jsclient/cloudmersive-image-client.js"></script>

To finish, call the API function with this code here.

var CloudmersiveImageApiClient = require('cloudmersive-image-api-client');var defaultClient = CloudmersiveImageApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveImageApiClient.RecognizeApi();var imageFile = "/path/to/file"; // File | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.recognizeDetectVehicleLicensePlates(imageFile, callback);

Yup, that’s it. Any license plate data will be stripped out of images and given back in this format:

{
"Successful": true,
"DetectedLicensePlates": [
{
"LicensePlateText_BestMatch": "string",
"LicensePlateText_RunnerUp": "string",
"LocationX": 0,
"LocationY": 0,
"Width": 0,
"Height": 0,
"LicensePlateRecognitionConfidenceLevel": 0
}
],
"DetectedLicensePlateCount": 0
}

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet