Home Blog Photography About

A Journey of Automatic Number Plate Recognition
1: OpenALPR

Previous: ANPR 0: Can't be that hard, right?

The easiest of course would be, to use some ready made projects. The first result on Github is OpenALPR.

The software is easy to use, comes with compiled binaries for windows and doesn't need a fancy GPU or anything like that. It also has bind ins for python and Go, which would ease integration into a live system.

Test 1: Daylight Smartphone Image.

Right out of the box, you can choose between eu and us recognition. Otherwise its straightforward. You give it an image or video file and it will start to look for license plates.


PS > .\alpr.exe --country eu "220627-anpr1-example1.jpg"
plate0: 2 results
    - HGJL1999   confidence: 93.4568
    - MGJL1999   confidence: 84.2401

It is very confident, and it is also correct. This picture was taken with my Galaxy S10e with a resolution of 4032x3024 px, in daylight from standing with a clear angle. That was an easy first test.

Test 2: Standing at an intersection.


With this second test already, its starting to struggle. We are standing at an intersection. This image is from a GrPro Hero 10 Black in 1080p timelapse mode. But the license plates are both very readable to a human. Let's see what OALPR has to say:

PS > .\alpr.exe --country eu "220627-anpr1-example2.png"
plate0: 10 results
    - JEF969     confidence: 89.9418
    - JEF69      confidence: 81.206
    - JEF9G9     confidence: 80.3793
    - JEF9B9     confidence: 80.1919
    - JEFS69     confidence: 79.524
    - JEFB69     confidence: 79.3816
    - JEF96S     confidence: 79.0742
    - JEF9S9     confidence: 78.453
    - JEF96B     confidence: 78.1725
    - JEFG69     confidence: 77.8414
plate1: 10 results
    - JEEEE      confidence: 77.4337
    - 3EEEE      confidence: 76.2578
    - JECEE      confidence: 70.2379
    - JCEEE      confidence: 69.3467
    - 3ECEE      confidence: 69.0619
    - 3CEEE      confidence: 68.1708
    - E0EEE      confidence: 67.9088
    - JEECE      confidence: 67.3845
    - JEEEC      confidence: 67.1375
    - 3EECE      confidence: 66.2086

The first license plate right in front of us is again very confident and also correct. But the second plate is way off.

The json output also tells us the coordinates, and we can see, that it would never have guessed the right plate for the Skoda, since it was looking in the wrong spot.


But at least it got one car right.

Test 3: Plate at an angle

This next shot is again from a Hero 10 in timelapse mode. Here we have a further away plate on the left that might be hard to read because of the low resolution and a closer plate on the right, that is at a 90° angle to the camera car.


PS > .\alpr.exe --country eu "220627-anpr1-example3.png"
No license plates found.

And this time ALPR is at a complete loss. It cannot recognise any of the plates.

Test 4: On the move

The last images were all taken from stillstand. But usually cars move. Thats kind of the point. So this example is taken from a moving car going around 100kmh on the Autobahn. Some slower, some faster. Camera is a Canon M3, 1080p Video. The quality is not the most stellar, light is overcast. But we're getting closer to normal dashcam quality, which should be the goal.


PS > .\alpr.exe --country eu "220627-anpr1-example4.png"
plate0: 10 results
    - BC4S4      confidence: 80.3427
    - IBC4S4     confidence: 79.4437
    - BCV4S4     confidence: 79.2158
    - BCY4S4     confidence: 78.646
    - IBC4S      confidence: 78.5115
    - IBCV4S4    confidence: 78.3168
    - BCV4S      confidence: 78.2836
    - IBCY4S4    confidence: 77.7471
    - BCY4S      confidence: 77.7138
    - BSC4S4     confidence: 77.5021

It can see the Trucks license plate and some of the guesses get close, but none are correct. Its probably too dark in the corner.

The diplomats limousine F:92100 on the left is totally ignored even though it is pretty straight on and quite readable in my opinion.

Test 5: Weird quirks, even in good conditions

The next is again from a Canon M3 in 1080p Video Mode. Weather is sunny, image is bright and all 3 license plates should be easy to read, not at an angle.


plate0: 10 results
    - ISHM9795   confidence: 87.4359
    - ISH9795    confidence: 87.1167
    - ISHH9795   confidence: 83.6881
    - ISHM979S   confidence: 79.2975
    - ISH979S    confidence: 78.9782
    - I5HM9795   confidence: 78.9516
    - I5H9795    confidence: 78.6324
    - ISMM9795   confidence: 77.1022
    - ISM9795    confidence: 76.783
    - ISHH979S   confidence: 75.5497
plate1: 10 results
    - 43609      confidence: 84.2433
    - 4S3609     confidence: 82.7441
    - 436O9      confidence: 73.7616
    - 436D9      confidence: 73.6458
    - 436Q9      confidence: 73.601
    - 4S36O9     confidence: 72.2625
    - 4S36D9     confidence: 72.1467
    - 4S36Q9     confidence: 72.1019
    - A3609      confidence: 70.8502
    - 436G9      confidence: 70.6937
plate2: 4 results
    - MKKE9999   confidence: 89.8723
    - NKKE9999   confidence: 83.1052
    - HKKE9999   confidence: 82.5762
    - KKE9999    confidence: 80.654

The Stuttgart Plate on the left is recognised nearly perfectly, but for some reason all the guesses have an I in front of them. For some reason the plate of the Police car on the right is missing the BWL part in all the guesses. The numbers are a perfect match though.


Under good conditions, it can bring some results. But sadly the real world is not always in perfect sunny 4k resolution. OpenALPR is promising but it doesn't quite work as well as I had hoped.