Extracting License Plate Details

 

After a car accident, knowing all the information about the vehicles involved is critical for insurance purposes.  You need to have the driver's information, and information about the car.  Imagine if you could collect it all with just your camera, and upload the photos to your adjuster automatically.

 

Alternatively, imagine you run a trucking yard, and want to track the arrival and departures of the trucks.  By reading the license plates - you can accurately timestamp truck movements.

 

But a photo of a license plate is just a photo - how do we extract the information from the plates for entry in to our processes?

 

With Mindee's License Plate API, you just upload an image of a vehicle (or vehicles for multiple plates) and the plates are identified and the text of the plate extracted.

 

API Prerequisites

 

  1. You’ll need a free Mindee account. Sign up and confirm your email to login.
  2. A photo of a car or turck witha European license plate visible. (The API is good, but not magic).

 

Setting Up the API

 

Log into your Mindee account and select the European License Plate API:

 

To activate the API, click the “Try for Free” button to access our generous free tier. You’ll land on the dashboard page - where you can quickly see API usage (you have none right now, but that will change).  On the left navigation, there are links to “Documentation”, “Credentials” and “Live Interface”.  The docs tab has all of the technical details you’ll need to build for the receipts API endpoint, and the Live Interface is a cool interactive demo. Rather than try out the demo, we want to build with the API,  so click on “Credentials” to create an API token.

 

Add a new token. In this example, I’ve named it “Tutorial”:

 

 

Click “Add New Key” and you’ll be able to see your API token,.

 

Making Your First API Call

 

We'll use curl from the terminal for your first call.  If you visit the Documentation tab, you can copy the code with your API key and paste directly into your command line

 

curl -X POST \
  https://api.mindee.net/products/license_plates/v1/predict \
  -H 'X-Inferuser-Token: {token}' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F file=@/Users/MyMac/Downloads/rewe_truck.jpg

 

The image I am using is a truck parked in a lot:

 

 

The Response

 

The API response is JSON:

{
	"call": {
		"endpoint": {
			"name": "license_plates",
			"version": "1.0"
		},
		"finished_at": "2020-10-08T20:14:26+00:00",
		"id": "58d3293f-b97b-4f5a-85ad-ed64a386f02f",
		"n_documents": 1,
		"n_inputs": 1,
		"processing_time": 0.474,
		"started_at": "2020-10-08T20:14:25+00:00"
	},
	"documents": [
		{
			"id": "22d5c578-ca4f-4b79-8071-dbd510e6db3c",
			"name": "rewe_truck.jpg"
		}
	],
	"predictions": [
		{
			"license_plates": [
				{
					"probability": 0.97,
					"segmentation": {
						"bounding_box": [
							[
								0.427,
								0.808
							],
							[
								0.515,
								0.808
							],
							[
								0.515,
								0.841
							],
							[
								0.427,
								0.841
							]
						]
					},
					"value": "BI04176"
				}
			]
		}
	]
}

 

In under half a second, the API returned a value for the license plate "BI04176" with 97% confidence.  The bounding box lists the [x,y] coordinates forming a rectangle around the plate in the image.

 

Summary

 

In just a few lines of code - we are able to automatically parse and extract the license plate information from a photo.  There are a number of applications that can now be implemented with a connected camera, the Mindee API and a little bit of code.

 

Let us know how you are planning to use the License plate API in your application!