iMicknl / cordova-plugin-openalpr

This Cordova plugin adds support for the OpenALPR (Automatic License Plate Recognition) library, which provides support for retrieving the license plate from a picture.
MIT License
33 stars 23 forks source link

Support for additional characters #14

Closed czery closed 7 years ago

czery commented 7 years ago

Hi there,

thanks for your implementation of OpenALPR for Cordova. I am just getting into this stuff and recognized that some plates may not me correctly recognized as they are using special characters (e.g. German Umlaute Ä/Ö/Ü)

I saw that there is a line in the runtime_data/config/eu.conf where you can add 'postprocess_regex_letters'. I tried to edit this and rm/add the platform after that but it did not have any effect on the recognition. Are these config files precompiled into the traineddata? Can you point me to an idea how to add characters to the recognition?

Cheers czery

melvinversluijs commented 7 years ago

Hi Czery,

That is indeed an interesting point. We are both Dutch so we never considered or tested this, but I've been trying to get this to work for a couple of hours now. Unfortunately without any success. However I have been able to confirm that changing the configuration file has effect on the recognition service.

The way I've been testing this is as follows:

  1. Have a local copy of the plugin (By downloading or cloning the git repo instead of installing the plugin with NPM)

  2. Edit the ios/lib/openalpr.framework/runtime_data/config/eu.conf for iOS or android/assets/runtime_data/config/eu.conf for Android. Save.

  3. Go to your cordova application (I use Ionic) and remove the platform (iOS or Android) from your platforms folder.

  4. Remove the cordova-plugin-openalpr from your plugin folder.

  5. Add your locally edited plugin to your cordova project by using the command: npm plugins add /path/to/plugin/root/folder followed by adding the desired platform npm platforms add android or npm platforms add ios.

  6. Build the project, Since I use Ionic I use the command ionic build ios to build the project.

  7. Open the application on an emulator or phone to test.

I only tested this on iOS.

If you don't get this to work I recommend making an issue on the official OpenALPR github repo (https://github.com/openalpr/openalpr/issues) since we only made OpenALPR usable with Cordova and are not the developers of the original framework.

Good Luck, and please keep me updated ;)

Cheers, Melvin

czery commented 7 years ago

Hi Melvin,

thanks for you reply. Unfortunately I did not get this to work either. I did not even see a difference in recognition after altering the eu.conf ...

However I researched a little about OpenALPR and regions and found out that the additional characters have to be trained for the OCR library (Tesseract) for OpenALPR being able to detect them. There is a repo with a tool for specifically training OpenALPR for a new license plate font https://github.com/openalpr/train-ocr

I will see if I can generate a new region for Germany in the next weeks which would recognize German Umlaute but should also improve the recognition in general as it would be for the German license plate font specifically.

I will keep you updated on this.

Cheers czery

iMicknl commented 7 years ago

Hi @czery,

Thanks for your update! It is indeed an issue with the trainingdata in OpenALPR itself. You can also find a related issue here, about white spaces in German license plates. Maybe you can also find some assistance there. We didn't know that German license plates are that hard to scan, with the white spaces and special characters (Umlaute).

I am gonna close this issue for now, since it is more an OpenALPR issue. Feel free to respond here if you have an update or create a pull request! 👍