1.在window上用cmake编译opencv for Android
编译Android平台的opencv
这里贴一下他的编译指令
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\..\android\android.toolchain.cmake ..\..\..
-DANDROID_NDK="D:\Android\sdk\ndk-bundle"
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9
-DCMAKE_MAKE_PROGRAM="D:\Android\sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe"
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="armeabi"
-DANDROID_NATIVE_API_LEVEL=14
-DANDROID_FORCE_ARM_BUILD=ON
-DWITH_CAROTENE=OFF
-DWITH_CLP=OFF
-DWITH_CUBLAS=OFF
-DWITH_CUDA=OFF
-DWITH_CUFFT=OFF
-DWITH_EIGEN=OFF
-DWITH_GDCM=OFF
-DWITH_GSTREAMER_0_10=OFF
-DWITH_JASPER=OFF
-DWITH_JPEG=OFF
-DWITH_NVCUVID=OFF
-DWITH_OPENCL=OFF
-DWITH_OPENCL_SVM=OFF
-DWITH_OPENEXR=OFF
-DWITH_OPENMP=OFF
-DWITH_OPENVX=OFF
-DWITH_PNG=ON
-DWITH_PTHREADS_PF=OFF
-DWITH_TBB=OFF
-DWITH_TIFF=OFF
-DWITH_WEBP=OFF
-DBUILD_ANDROID_EXAMPLES=OFF
-DBUILD_ANDROID_SERVICE=OFF
-DBUILD_CUDA_STUBS=OFF
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_FAT_JAVA_LIB=OFF
-DBUILD_JASPER=OFF
-DBUILD_JPEG=OFF
-DBUILD_OPENEXR=OFF
-DBUILD_PACKAGE=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_PNG=ON
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TBB=OFF
-DBUILD_TESTS=OFF
-DBUILD_TIFF=OFF
-DBUILD_WITH_DEBUG_INFO=OFF
-DBUILD_WITH_DYNAMIC_IPP=OFF
-DBUILD_opencv_apps=OFF
-DBUILD_opencv_calib3d=ON
-DBUILD_ZLIB=ON
-DBUILD_opencv_core=ON
-DBUILD_opencv_features2d=ON
-DBUILD_opencv_flann=ON
-DBUILD_opencv_highgui=ON
-DBUILD_opencv_imgcodecs=ON
-DBUILD_opencv_imgproc=ON
-DBUILD_opencv_java=OFF
-DBUILD_opencv_ml=ON
-DBUILD_opencv_objdetect=OFF
-DBUILD_opencv_photo=OFF
-DBUILD_opencv_shape=OFF
-DBUILD_opencv_stitching=OFF
-DBUILD_opencv_stereo=OFF
-DBUILD_opencv_superres=OFF
-DBUILD_opencv_ts=OFF
-DBUILD_opencv_video=OFF
-DBUILD_opencv_videoio=OFF
-DBUILD_opencv_line_descriptor=OFF
-DBUILD_opencv_reg=OFF
-DBUILD_opencv_saliency=OFF
-DBUILD_opencv_videostab=OFF
-DBUILD_opencv_world=OFF
-DCMAKE_CXX_FLAGS="-ffunction-sections
-fdata-sections -fvisibility=hidden -O3 -std=c++11 -mfloat-abi=softfp -mfpu=neon -march=armv7-a -mtune=cortex-a8"
-DCMAKE_C_FLAGS="-ffunction-sections -fdata-sections -fvisibility=hidden -O3 -mfloat-abi=softfp -mfpu=neon -march=armv7-a -mtune=cortex-a8"
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--gc-sections"
-DBUILD_opencv_xfeatures2d=OFF
-DBUILD_opencv_face=OFF
-DBUILD_opencv_bgsegm=OFF
-DBUILD_opencv_datasets=OFF
-DBUILD_opencv_dpm=OFF
-DBUILD_opencv_tracking=OFF
-DBUILD_opencv_xobjdetect=OFF
-DBUILD_opencv_optflow=OFF
-DBUILD_opencv_tracking=OFF
-DENABLE_NEON=ON
-DOPENCV_EXTRA_MODULES_PATH="E:/opencv_contrib-3.2.0/modules"
-DBUILD_opencv_ximgproc=ON
-DBUILD_opencv_dnn=OFF
-DBUILD_opencv_structured_light=OFF
-DBUILD_opencv_surface_matching=OFF
-DBUILD_opencv_text=OFF
-DBUILD_opencv_xphoto=OFF
-DBUILD_opencv_fuzzy=OFF
-DBUILD_opencv_bioinspired=OFF
-DBUILD_opencv_phase_unwrapping=OFF
-DBUILD_opencv_plot=OFF
-DBUILD_opencv_rgbd=OFF
-DBUILD_opencv_aruco=OFF
2.编译出静态库供基本的使用
参考文章
opencv2.4.9:为caffe编译精简的opencv_core,opencv_imgproc,opencv_highgui全静态库
3.opencv的core库的裁剪
参考
OpenCV从入门到放弃(三):Core组件细讲
4.一些可能会用到的文章
opencv3.2+opencv_contrib+cmake (源码编译,编出来的是window的)
Android Studio Cmake & OpenCV3.2环境(基本集成,无源码编译)
使用Android Studio 2.2和Cmake (CMakeLists)让OpenCV 飞起来(基本集成,无源码编译)
ORB_SLAM2在Android上的移植过程 (Android Studio 2.2+OpenCV 3.2+Cmake)(如何集成其他的项目)
教你快速将大量代码文件加入到VS项目中
//待续