I'm using CMAKE to build OpenALPR, which uses OpenCV.
My CMakeLists.txt contains, among other, the following statements :
# Discover OpenCV directory automatically
find_path(OpenCV_DIR
NAMES OpenCVConfig.cmake
HINTS ${CMAKE_SOURCE_DIR}/../libraries/opencv/
/storage/projects/alpr/libraries/opencv/
)
# Opencv Package
FIND_PACKAGE( OpenCV REQUIRED )
CMake doesn't complain about anything, so I assume OpenCV is found (plus, loads of things are built using OpenCV before the error I'm about to mention).
The instruction I use to build everything :
cmake \
-DANDROID_TOOLCHAIN=g++ \
-DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake \
-DANDROID_NDK=$NDK_ROOT \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DANDROID_ABI="$i" \
-DANDROID_STL=c++_shared \
-DANDROID_CPP_FEATURES="rtti exceptions" \
-DTesseract_INCLUDE_BASEAPI_DIR=$TESSERACT_SRC_DIR/api \
-DTesseract_INCLUDE_CCSTRUCT_DIR=$TESSERACT_SRC_DIR/ccstruct \
-DTesseract_INCLUDE_CCMAIN_DIR=$TESSERACT_SRC_DIR/ccmain \
-DTesseract_INCLUDE_CCUTIL_DIR=$TESSERACT_SRC_DIR/ccutil \
-DTesseract_LIB=$TESSERACT_LIB_DIR/libtess.so \
-DLeptonica_LIB=$TESSERACT_LIB_DIR/liblept.so \
-DOpenCV_DIR=$SCRIPTPATH/../OpenCV-android-sdk/sdk/native/jni \
-DJAVA_AWT_LIBRARY=$JAVA_AWT_LIBRARY \
-DJAVA_JVM_LIBRARY=$JAVA_JVM_LIBRARY \
-DJAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH \
-DJAVA_INCLUDE_PATH2=$JAVA_INCLUDE_PATH2 \
-DJAVA_AWT_INCLUDE_PATH=$JAVA_AWT_INCLUDE_PATH \
-DPngt_LIB=$TESSERACT_LIB_DIR/libpngt.so \
-DJpgt_LIB=$TESSERACT_LIB_DIR/libjpgt.so \
-DJnigraphics_LIB=$NDK_ROOT/platforms/$ANDROID_PLATFORM/arch-$arch/usr/$lib/libjnigraphics.so \
-DANDROID_ARM_MODE=arm \
../../src/
Notice that I use the Android OpenCV SDK v3.4.3. I have an undefined error :
openalpr/src/misc_utilities/prepcharsfortraining.cpp:224: error: undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray const&, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)'
The incriminating file has the following include statements :
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <sys/stat.h>
#include "support/filesystem.h"
#include "../tclap/CmdLine.h"
#include "support/utf8.h"
using namespace std;
using namespace cv;
using namespace alpr;
I can't figure out why imwrite cannot be found. I've tried with Android NDK 20,16 and 14 with no luck