Download OpenCV:
$ export OPENCV_VERSION=3.4.3
$ git co opencv_contrib && cd opencv_contrib && git co $OPENCV_VERSION
$ git co opencv
$ cd opencv
$ git co $OPENCV_VERSION
$ mkdir build-arm
Run ./cmake-gui to generate Makefile's.
- Click the
Browse Sourcebutton and give the OpenCV source folder. - Click the
Browse Buildbutton and give the build folder:build-arm - Click
Configurebutton, selectSpecify toolchain file for cross-compiling. In the next prompt window, make sure to select theandroid.toolchain.cmakeunder$HOME_NDK/build/cmake/. Make sure not to use the file under opencv folder. - Add entries:
- Set
ANDROID_PLATFORMtoandroid-23(or any other) - Set
ANDROID_STLtoc++_static - Set
BUILD_ANDROID_PROJECTStofalse(skip Gradle problems) - Set
BUILD_ANDROID_EXAMPLEStofalse - Set
CMAKE_BUILD_TYPEtoRelease - Set
OPENCV_EXTRA_MODULES_PATHtoopencv_contrib/modules - Set
OPENCV_ENABLE_NONFREEtotrue
- Click
ConfigureandGenerate
Build and install:
$ cd build-arm
$ make -j1
$ make install
References: