Skip to content

twelve17/openalpr-android-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

openalpr-android-config

A bash script, loosely based on this Wiki entry from the openalpr repo, and my experience trying to walk through it, to build openalpr and its dependencies for using in an Android Studio project.

Environment

The script was written to work under Mac OS X, but may work under Linux with some modifications.

Tested under:

Note: As of the openalpr commit shown above, the script also runs a patch against the openalpr source to fix a compilation issue in filesystem.cpp. The patch change is based on this post.

Prerequisites

The script assumes some convention with regards to the location of some of the packages, and expects some environment variables to be set to help it along.

  $HOME/Android/
      |- adt-bundle-mac-x86_64-20140702/
      |- android-ndk-r10d/
      |- OpenCV-2.4.10-android-sdk/

You must install these prerequisites before running the script.

(Also, FYI: the script will install android-cmake to $ANDROID_DEV_ROOT/android-cmake.)

Installation

  • Clone this repo:

    git clone https://github.com/twelve17/openalpr-android-config
    
  • Edit the bin/build_dependencies.sh file, and change the values of these variables to match your setup:

    • ANDROID_DEV_HOME
    • ANDROID_PLATFORM
    • ANDROID_SDK_NAME
    • ANDROID_NDK_NAME
    • ANDROID_OPENCV_SDK_NAME
    • JAVA_SDK_DIR

Execution

Run the script from the root of the project:

 ./bin/build_dependencies.sh

The script will download tess-two, android-cmake, and openalpr. It will then compile the tess-two and openalpr libraries for all platforms specified in the BUILD_ARCHS variable.

Once completed, you should have a directory openalpr-android-config/work/output, which contains a libs and includes directory, with the tess-two and openalpr libraries. You can then copy these into your Android project by hand (along with the openalpr_java.so libraries from $ANDROID_OPENCV_SDK/jni/libs).

Alternatively, if you have an Android Studio project, you can add the path to your project to the script, and it will copy the tess-two, openalpr, and opencv libraries and header files to your project. Assuming the file hierarchy below, you will end up wih something like this:

/path/to/your/android/studio/project/app/src/main
    |- jni
    |    |- include
    |         |- openalpr
    |         |    |- ...
    |         |- tesseract
    |              |- ...
    |- jniLibs
         |- armeabi
         |    |- liblept.so
         |    |- libopenalpr-static.a
         |    |- libsimpleini.a
         |    |- libsupport.a
         |    |- libtess.so
         |- armeabi-v7a
         |    |- ...
         |- ...

Given the above path to the project, run the script like this:

 ./bin/build_dependencies.sh /path/to/your/android/studio/project

You will still need to build any of your own project's JNI classes per the Wiki instructions (e.g. creating an Android.mk file, etc).

Notes

About

Build openalpr and its dependencies for using in an Android Studio project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published