How to recognize a vehicle license / number plate (ANPR) in an image?

I have a website that allows users to upload car images, and I would like to set a privacy filter to detect license plates on the car and blur them.

Blurring is not a problem, but is there a library or component (open source preferred option) that will help you find the license for the photograph?

Warning;

  • I know that there is nothing perfect, and recognition of images of this type will provide false positive and negative sides.
  • I appreciate that we could ask the user to select the area to blur, and we will do it too, but the question is to find this data programmatically; therefore, answers such as โ€œget a person to check each imageโ€ do not help.
  • This software method is called "Automatic License Plate Recognition" in the UK, but I do not see any of its implementations as libraries.
  • Any language is excellent, although .Net is preferred.
+54
image computer-vision ocr anpr
Jun 11 '09 at 14:18
source share
12 answers

I encoded a C # version based on JAVA ANPR, but I changed the awt library functions using OpenCV. You can check it out at http://anprmx.codeplex.com

+27
Nov 07
source share

EDIT . I wrote a Python script for this.

Since your goal is blurring (to protect privacy), you first need a high recall detector. Here's how to do it. The code hints introduced use OpenCV with Python.

  • Convert to shades of gray.
  • Apply Gaussian Blur.

    img = cv2.imread('input.jpg',1) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) img_gray = cv2.GaussianBlur(img_gray, (5,5), 0) 

Let the input image be as follows.

enter image description here

  1. Apply a Sobel filter to identify vertical edges.
  2. Threshold of the resulting image using strict threshold or OTSU binarization.

     cv2.Sobel(image, -1, 1, 0) cv2.threshold() 
  3. Apply a morphological closure operation using a suitable structural element. (I used 16x4 as a structuring element)

     se = cv2.getStructuringElement(cv2.MORPH_RECT,(16,4)) cv2.morphologyEx(image, cv2.MORPH_CLOSE, se) 

The resulting image after step 5.

enter image description here

  1. Find the outer contours of this image.

     cv2.findContours(image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) 
  2. For each path, find minAreaRect() to bound it.

  3. Select rectangles based on aspect ratio, minimum and maximum area, and horizontal angle. (I used 2.2 <= Aspect Ratio <= 8, 500 <= Area <= 15000 and angle <= 45 degrees).

All minAreaRect() are shown in orange, and the value that matches our criteria is green.

enter image description here

  1. After this step, there may be false positives to filter it, use the edge density. Edge Density is defined as the number of white pixels / total number of pixels in the rectangle. Set the edge density threshold. (I used 0.5)

enter image description here

  1. Blur detected areas.

enter image description here

You can apply other filters that you think are appropriate to increase the number of reminders and accuracy. Detection can also be trained using HOG + SVM to improve accuracy.

+17
May 30 '16 at 10:35
source share

GitHub has a new open source library that makes ANPR for American and European plates. It looks pretty neat and it should do exactly what you need (find out the areas of the plates). Here is the GitHub project: https://github.com/openalpr/openalpr

+11
Jan 09 '14 at 5:17
source share

I came across this written in java javaANPR . I am also looking for a C # library.

I need a system where I can point the video camera on some sailing boats, all of which have large identification numbers on them, and let them identify the boats and send a tweet when they sail past the video camera.

+10
Aug 10 '09 at 10:05
source share

I made several attempts a couple of years ago. There are quite a few articles on this topic, but I have never found a specific open source implementation. There are many commercial implementations , although none of them have a price quote, so they are probably quite expensive.

+8
Jun 11 '09 at 14:49
source share

try this automatic license plate recognition system

http://opos.codeplex.com/

Open source and written using C #

+5
Mar 30 '12 at 19:38
source share

Take a look at Java ANPR . Free license plate recognition ...

+3
Aug 23 '10 at 6:32
source share

Yes I am using gocr at http://jocr.sourceforge.net/ my command line application, which you can run from your application. I use it in several of my applications.

+2
May 19 '10 at 9:32 a.m.
source share

High Performance ANPR Library - http://www.dtksoft.com/dtkanpr.php . It is commercial, but they provide a trial key.

+2
Sep 23 '10 at 10:19
source share

http://licenseplate.sourceforge.net Python (I have not tested it)

+2
Mar 30 '12 at 16:05
source share

Perhaps this works by looking at the Recoqnition software for the character, since there are many libraries that do the same thing. I read the image and save it. Micrsoft office can read tiff files and return alphanumeric characters

-one
Dec 03 '09 at 13:33
source share

Blurring is not a problem, but is there a library or component (the preferred open source option) that will help you find the license for the photo?

Ans: Software Engine CARMEN FreeFlow ANPR (Commerical)

-2
Jun 11 '09 at 14:27
source share



All Articles