I have a OpenCV project in Android Studio for an app, it uses C++ for the OpenCV processing part and I want to combine it with Tesseract (C++) for text recognition.
I've been searching for info but I don't know where to start or what is the correct way to do it, sorry for not knowing how to explain very well, i'm kinda new using C++ in Android Studio for Mobile Development.
Here is what i want:
#include <jni.h>
#include "opencv2/core.hpp"
#include <opencv2/imgproc.hpp>
#include <fstream>
//need Tesseract and Leptonica libraries
using namespace cv;
using namespace std;
extern "C"
JNIEXPORT void JNICALL Java_com_example_opencv_NativeClass_detect_1letters(JNIEnv *env, jclass clazz, jlong frame) {
//TODO: OpenCV and Tesseract code
}
Here is my CMakeLists.txt if needed:
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
include_directories(${CMAKE_SOURCE_DIR}/src/main/jniIncludes)
add_library(native-lib
SHARED
src/main/cpp/native-lib.cpp)
add_library(lib_opencv SHARED IMPORTED)
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java3.so)
find_library(log-lib
log)
target_link_libraries(native-lib ${log-lib} lib_opencv)