Build OpenCV 3.3.1 with Android / Gradle / CMake

asked 2017-12-05 04:40:19 -0600

What I want to do :

  • build library OpenCV 3.3.1 from native cpp files using Android / Gradle / Cmakelists.txt

Using :

  • OpenCV_3.3.1

  • Android Studio 2.2.3

  • Gradle 2.14.1

I create a module "opencv_3.3.1", inside the build.gradle file I insert a block cmake { } with the path of "opencv/CMakeLists.txt"

Result : Gradle runs some tasks, but none cpp file is compiled.

I look at so many documentation that I don't know what to do now ! I am a experienced programmer, but I am a novice with Android and with OpenCV.

Thank you for your help, Bernard

edit retag flag offensive close merge delete

Comments

please clarify, -- do you want to build an android app, or do you want to rebuild the opencv libs ?

( it might just be, you're out of luck with your toolchain. building the opencv4android sdk would require a recent android ndk, python, cmake and ninja, please have a look here )

berak gravatar imageberak ( 2017-12-05 04:52:07 -0600 )edit

Yes, I want to rebuild the opencv libs on Windows-7 !

Do you mean I have to get the "opencv/platforms/android/" files from master branch ?

bernard gravatar imagebernard ( 2017-12-05 07:01:11 -0600 )edit

i have no idea, whatyou have, but you need the whole https://github.com/opencv/opencv repo.

if you also want face recognition, text or tracking, you would need https://github.com/opencv/opencv_contrib, too.

then cd into the platforms/android folder, and run the python build script.

berak gravatar imageberak ( 2017-12-05 07:45:06 -0600 )edit