Michel Layyous Michel Layyous - 4 months ago 20
Java Question

Localizing JavaAnpr for local license plates

Has anyone here dealt with JavaAnpr?

While it works well with European license plates, it doesn't with my country. For example;

License plate from my country

Is there any documentation out there that would help in editing the recourse files and syntax XML? Or perhaps, a better library for licence plate recognition, that is free and in Java?

Answer

@michel_layyous - Here's the documentation by the author. Read Page 57: http://javaanpr.sourceforge.net/anpr.pdf

syntax.xml is essentially a regex file.

Using this page as an example: https://code.google.com/p/android-anpr/source/browse/trunk/res/raw/syntax.xml?r=21

<type name="russia">
   <char content="abcehkmoptxy"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
   <char content="abcehkmoptxy"/>  
   <char content="abcehkmoptxy"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
</type>

This Russian license plate pattern is 8 characters. The first character can be any of those letters. The next 3 characters can be any number from their respective set. The next 2 characters can be any of those letters from their respective set, and the last 2 characters can be any of those letters from their respective set.

The next Russian license plate is just like the first Russian license plate, except one key difference:

<type name="russia2">
   <char content="abcehkmoptxy"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
   <char content="abcehkmoptxy"/>  
   <char content="abcehkmoptxy"/>
   <char content="012"/>
   <char content="0123456789"/>
   <char content="0123456789"/>
</type>

The 6th character can only be a 0, 1, or 2.

I also found a relevant blurb on this page: http://www.mp3car.com/software-and-software-development/124529-automatic-number-plate-recognition-anpr-3.html

I found a very similar license plate for your country, however it consists of two rows. The first two numbers are on the top row, and there are 5 numbers on the bottom row. It looks like your country has 7 digits for your particular style of plate. I don't how the dot factors into the recognition of your plate, however, Page 58 of the author's documentation states:

The correction of a plate means the replacement of each invalid character by another one. If the character ( ) i p at the i th position of the plate P does not match the selected pattern ( ) ` sel P , it will be replaced by the first valid one from ( ) s y . ( ) s y is a sorted vector of output activities denoting how much the recognized character is similar to an individual character from the alphabet. Heuristic analysis of a segmented plate can sometim es incorrectly evaluate non-character elements as characters. Acceptance of the non-chara cter elements causes that the recognized plate will contain redundant characters. Redundant characters occur usually on sides of the plate, but rarely in the middle. If the recognized plate number is longer than the l ongest syntax pattern, we can select the nearest pattern, and drop the redundant characters according to it.