Saturday, 21 July 2018

Avoiding redundant build to make tessaract android library && link tessaract library to c++ NDK

Now I am making an application using on MacOSx with Tessaract and Android NDK. I use Eclipse as an IDE to develop the program.

I have two questions to ask:

1). I set up tessaract using the most famous example "tess-two" and modified a bit to fit with my existing code. I copied folder "com_googlecode_leptonica_android" and "com_googlecode_tessaract_android" to /jni folder. Then edit Android.mk for setting path to those library folder. Everything works fine! Except one thing.. Every time that I build the project, I need to build both "leptonica" and "tessaract" library again and again..in order to get libtess and liblept.. It takes soooo long. How can I edit android makefile (Android.mk) not to build those libraries.. just compile my code only... thats all.. Here is my Android.mk

LOCAL_PATH := $(call my-dir)
MY_PATH := $(LOCAL_PATH)
TESSERACT_PATH := $(call my-dir)/com_googlecode_tesseract_android
LEPTONICA_PATH := $(call my-dir)/com_googlecode_leptonica_android

include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
include /Applications/eclipse-android/OpenCV-2.4.3-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_PATH := $(MY_PATH)
LOCAL_MODULE    := my_project
LOCAL_SRC_FILES := cppmain.cpp
LOCAL_LDLIBS +=  -llog -ldl

include $(BUILD_SHARED_LIBRARY)
)

2). I found a lot of examples about using tessaract with Android. However most of them using tessaract with Java (call via JNI) and call JNI from java code (Java -> Tessaract C++ JNI -> Tessaract C++). I cannot find any example that call tessaract from c++ NDK (Java -> my JNI -> my C++ -> Tessract C++). The reason that I want to call tessaract directly from c++ is portability.



from Avoiding redundant build to make tessaract android library && link tessaract library to c++ NDK

No comments:

Post a Comment