Can OpenCV for Android leverage the standard C++ Support to get native build support on Android Studio 2.2 for Windows?

后端 未结 4 1217
谎友^
谎友^ 2020-12-01 02:45

There are many questions and answers surrounding getting native opencv for android building properly. Some use gradle, others use external tools. These numerous, complicate

4条回答
  •  囚心锁ツ
    2020-12-01 03:23

    With OpenCV 3.2 configuration could be actually quite short:

    set(OpenCV_STATIC ON)
    set(OpenCV_DIR ${OPENCV_HOME}/sdk/native/jni)
    find_package (OpenCV REQUIRED)
    
    target_link_libraries(native-lib ${OpenCV_LIBS})
    

    That is it, 4 lines and no need to copy anything into your project. Just be sure that OPENCV_HOME points to the directory where OpenCV Android SDK is located.

    One additional benefit of this approach - you can link with OpenCV statically, which would dramatically reduce the size of your app/library.

    I use this approach in one of Github projects: https://github.com/Fotoapparat/FaceDetector

提交回复
热议问题