Extending License Plate Extraction
Published: 2021-02-25 22:22:39

---
title: Extending License Plate Extraction
published: true
description: 
tags: 
cover_image: https://mindee-public-website.s3.amazonaws.com/blog/20171014_132527_copy.jpg
canonical_url: https://mindee.com/blog/extending-license-plate-extraction
---


<p><span style="color:#000000">If you&rsquo;re like me, you&rsquo;ve gotten a speeding ticket.&nbsp; Even more like me, it was a speeding ticket&hellip;from a camera. My last ticket was in Dresden. I was crossing a bridge over the Elbe, and the signs all of a sudden said 50 km/hr.. And I was&hellip;. Well I was going over that.&nbsp; A few weeks later, a ticket arrived in our mailbox.&nbsp;&nbsp;</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">The ticket had a photo of my car (with me driving).&nbsp; You could see our license plate, but to show that there was no possibility of mistake, they also gave a closeup of our plate.&nbsp; With the details from my UK plates, they were able to look up my address and assign the ticket to me.</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">How did they scan the image for a license plate?&nbsp; Likely using an OCR or machine learning API like<a href="https://mindee.com/documentation/apis/extract-license-plate-data"> Mindee&rsquo;s License plate API</a>.&nbsp; When this API is provided a photo of a car (where the license plates are visible), it will find the region of the plate, and extract the details form that part of the plate.</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">For example, when I submit this image (from Google Image search)</span></p>

<p><img alt="" src="https://mindee-public-website.s3.amazonaws.com/blog/2020/11/20/screenshot-2020-11-20-at-081606.png" style="height:321px; width:500px" /></p>

<p><span style="color:#000000">I received the response &ldquo;LR33TEE&rsquo;.&nbsp; Read all about how to use our License plate API in our <a href="https://mindee.com/documentation/apis/extract-license-plate-data">tutorial</a>.</span></p>

<p>&nbsp;</p>

<h2><span style="color:#000000">What can I to with the license tag information</span></h2>

<p>&nbsp;</p>

<p><span style="color:#000000">Governments are able to identify us based on our plate.&nbsp; But what data can we extract from license plates?&nbsp; I know that in some countries, like Ireland and Germany, you can identify the region of the car&rsquo;s origin from the letters on the plate.&nbsp; BUt I want more information.</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">But can we learn more?&nbsp; The UK government has a free <a href="https://developer-portal.driver-vehicle-licensing.api.gov.uk/apis/vehicle-enquiry-service/vehicle-enquiry-service-description.html#register-for-ves-api">API through the DVLA</a> that uses the license plate number and provide information about the vehicle:</span></p>

<p><br />
<span style="color:#000000">The call (using Axios in Node) looks like this:</span><br />
&nbsp;</p>

<pre>
<code class="language-javascript">  config: {

    url: 'https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles',

    method: 'post',

    data: '{"registrationNumber":"LR33TEE"}',

    headers: {

      Accept: 'application/json, text/plain, */*',

      'Content-Type': 'application/json',

      'x-api-key': &lt;API TOKEN&gt;',

      'User-Agent': 'axios/0.20.0',

      'Content-Length': 32</code></pre>

<p>&nbsp;</p>

<p>Now, it turns out, &quot;LR33TEE&quot; is not in the DVLA database. It&#39;s probably a fake reg tag Photoshopped for the article.&nbsp; So, we&#39;ll try again:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website.s3.amazonaws.com/blog/2020/11/23/petrol_blur.jpg" style="height:754px; width:615px" /></p>

<p>&nbsp;</p>

<p><span style="color:#000000">When you call this API, the response looks like this:</span></p>

<pre>
<code>DVLA response {
  registrationNumber: 'S638GWH',
  engineCapacity: 1396,
  markedForExport: false,
  fuelType: 'PETROL',
  motStatus: 'Not valid',
  colour: 'SILVER',
  make: 'HONDA',
  yearOfManufacture: 1999,
  taxDueDate: '2016-11-04',
  taxStatus: 'Untaxed',
  dateOfLastV5CIssued: '2015-02-23',
  motExpiryDate: '2016-12-15',
  wheelplan: '2 AXLE RIGID BODY',
  monthOfFirstRegistration: '1999-01'
</code></pre>

<p><span style="color:#000000">Now, this&nbsp;image is from an article with&nbsp;CCTV camera footage about a person stealing petrol.&nbsp; It is an older article, and as you can see - an older car, that is no longer taxed or has a valid MOT - probably in a junkyard somewhere.</span></p>

<p><span style="color:#000000">What can we do with this data?&nbsp; For me, this is great, I can never remember when my MOT is due, or when I need to retax my car.&nbsp; Now I can use this API to quickly look up my car - just by knowing the numbers on my license plate. (They have a website where you can type this in).</span></p>

<p>&nbsp;</p>

<h2><span style="color:#000000">But it can be easier!</span></h2>

<p><span style="color:#000000">Combining DVLA and Mindee&rsquo;s License plate API, I can submit a photo of a vehicle, and it will extract the registration number automatically.&nbsp; Then this text string can be sent to the DVLA for a response.</span></p>

<p><span style="color:#000000">I&rsquo;ve built a super simple demo - use your phone to take a photo of a car with a UK license plate, and you can know the MOT date:</span></p>

<p><a href="https://demo-license-plates.mindee.com/MOT" style="text-decoration:none"><span style="color:#1155cc"><u>https://demo-license-plates.mindee.com/MOT</u></span></a></p>

<p>Want to know when your tax is due?</p>

<p><a href="https://demo-license-plates.mindee.com/TAX" style="text-decoration:none"><span style="color:#1155cc"><u>https://demo-license-plates.mindee.com/TAX</u></span></a><span style="color:#000000"> </span></p>

<p><span style="color:#000000">will tell you when your taxes need to be renewed.&nbsp; </span></p>

<p><span style="color:#000000">Finally,&nbsp;</span><a href="https://demo-license-plates.mindee.com/CAMERA" style="text-decoration:none"><span style="color:#1155cc"><u>https://demo-license-plates.mindee.com/CAMERA</u></span></a><span style="color:#000000"> will give you the full output from the DVLA API.</span></p>

<p>Watch a video on how this magic works:</p>

<p><iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/4KmM9wG7lL8" width="560"></iframe></p>

<p>Want to try out the code?&nbsp; It&#39;s available on <a href="https://github.com/dougsillars/mindee_plates_DVLA">Github</a>.</p>

<p>&nbsp;</p>

<h2><span style="color:#000000">Going Further</span></h2>

<p><span style="color:#000000">What else could the combination of Mindee with DVLA information&nbsp;be used for?&nbsp; Thinking about the CCTV image at the&nbsp;petrol station.&nbsp; What if the API looked up the car for everyone pumping gas.&nbsp; The API contains the type of fuel for the vehicle.&nbsp; According to <a href="https://www.rac.co.uk/drive/advice/know-how/wrong-fuel-recovery/">insurance estimates, over 150,000 vehicles</a> in the UK accidentally pump the incorrect fuel into their gas tank.&nbsp; By taking a photo with the CCTV, the station can know what type of fuel should be used, and can stop the pump if the incorrect fuel line is connected.</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">Again - thinking of the image above: perhaps cars with expired tax and MOT are more likely to not pay for petrol, so these cars could be given a lower volume of petrol as a prepay.</span></p>

<p>&nbsp;</p>

<p><span style="color:#000000">Finally, if the station is also a service station - the receipt could also print a coupon for MOT service -reminding the customer that their MOT expires in 3 months.. 2 months.. 1 month, and give an appropriate discount for scheduling their service early.</span></p>

<p>&nbsp;</p>

<h2><span style="color:#000000">Conclusion</span></h2>

<p>&nbsp;</p>

<p><span style="color:#000000">The Mindee License plate API is both elegant and simple.&nbsp; You get useful information (the license plate number) just from a photo.&nbsp; Automatic parsing of a photo for this information now opens up a gateway of new opportunities. Now you can use additional APIs to probe for more information about a specific car or truck.</span></p>

<p>&nbsp;</p>