You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenALPR is an open source Automatic License Plate Recognition library written in C++ with bindings in C#, Java, Node.js, and Python. This project ports this library to Android. You can find the demo application apk at the releases tab.
Gradle Dependency
Repository
First, add the following to your app's build.gradle file:
dependencies {
// ... other dependencies here.
compile 'com.github.SandroMachado:openalpr-android:1.1.2'
}
Usage
Code
Copy the OpenALPR configuration file to your android project assets directory /main/assets/runtime_data/openalpr.conf, open it and update the runtime_dir to your project directory (for instance, for the sample project the directory is: runtime_dir = /data/data/com.sandro.openalprsample/runtime_data). After that just follow the code example bellow. To see a full example check the sample application.
/* Method interface.*//** * Recognizes the licence plate. * * @param country - Country code to identify (either us for USA or eu for Europe). Default=us. * @param region - Attempt to match the plate number against a region template (e.g., md for Maryland, ca for California). * @param imgFilePath - Image containing the license plate. * @param configFilePath - Config file path (default /etc/openalpr/openalpr.conf) * @param topN - Max number of possible plate numbers to return(default 10) * * @return - JSON string of results */publicStringrecognizeWithCountryRegionNConfig(Stringcountry, Stringregion, StringconfigFilePath, StringimgFilePath, inttopN);
Sample Application
The repository also includes a sample application that can be tested with Android Studio.