1. 切换到 OpenCV 的源代码目录下。
2.
修改 ${opencv_home}/platforms/scripts/cmake_android_arm.sh 文件,添加编译选项 -DBUILD_SHARED_LIBS=ON 和 -DWITH_OPENCL=ON
3.
修改 ${opencv_home}/cmake/OpenCVDetectOpenCL.cmake
set(OPENCL_FOUND YES)
set(OPENCL_INCLUDE_DIR "path1") // path1 是OCL头文件所在的路径。
set(OPENCL_LIBRARY "path2") // path2 是OCL库文件的路径,这个和设备相关。
4.
修改 ${opencv_home}/CMakeLists.txt OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT IOS) )
5. 执行 ${opencv_home}/platforms/scripts/cmake_android_arm.sh
6. 切换到 ${opencv_home}/platforms/build_android_arm 目录
7.
make
最终android动态库在${opencv_home}/platforms/build_android_arm/lib/armeabi-v7a下生成。
这些库就可以在android的工程里面直接用了呦。