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 Source
button and give the OpenCV source folder. - Click the
Browse Build
button and give the build folder:build-arm
- Click
Configure
button, selectSpecify toolchain file for cross-compiling
. In the next prompt window, make sure to select theandroid.toolchain.cmake
under$HOME_NDK/build/cmake/
. Make sure not to use the file under opencv folder. - Add entries:
- Set
ANDROID_PLATFORM
toandroid-23
(or any other) - Set
ANDROID_STL
toc++_static
- Set
BUILD_ANDROID_PROJECTS
tofalse
(skip Gradle problems) - Set
BUILD_ANDROID_EXAMPLES
tofalse
- Set
CMAKE_BUILD_TYPE
toRelease
- Set
OPENCV_EXTRA_MODULES_PATH
toopencv_contrib/modules
- Set
OPENCV_ENABLE_NONFREE
totrue
- Click
Configure
andGenerate
Build and install:
$ cd build-arm
$ make -j1
$ make install
References: