Using Android Studio C ++ Support to Create Non-Free OpenCV Modules

Background

Although older versions of OpenCV (i.e. 2.4) allow Android projects to use SIFT functionality, splitting these functions into opencv_contrib complicates the task; Integration of the OpenCV-3.xx-android-sdk module into the project deprives you of the opportunity to use the SIFT functionality.

 FeatureDetector.create(FeatureDetector.DYNAMIC_SIFT); // Fails //OpenCV Error: Bad argument (Specified feature detector type is not supported.) 

Using external tools

Although there are methods like Goey Wang that describe how to integrate the non-free part of OpenCV into an Android project, this process requires external tools. This question is about how to get the same result, but instead use the power and convenience of Android Studio / InteliJ.

Using CMake in Android Studio

Modern versions of Android Studio have useful functionality:

Using Android Studio 2.2 and higher, you can use the NDK to compile C and C ++ code into your own library and pack it into your APK using Gradle, an integrated IDE build system. Your Java code can then call functions in your own library through your own Java interface (JNI)

As pointed out in this question and answer to https://stackoverflow.com/a/4129/168/ ... , you can quickly integrate OpenCV 3.1 (and I suspect other versions) opencv4android into the C ++ assembly structure generated in the New Applications Wizard.

I suspect that someone who understands the details of construction projects might use Building_OpenCV4Android_from_trunk to answer this question. My experience in this area is limited, so the question is.

What specific steps will be required to make the non-free part of OpenCV fully assemble during the build process of Android Studio?

+15
android-studio opencv cmake opencv4android
source share

No one has answered this question yet.

See similar questions:

14
Can OpenCV for Android use standard C ++ support to support native builds on Android Studio 2.2 for Windows?

or similar:

24
Error: your project contains C ++ files, but it does not use the built-in built-in assembly
14
Can OpenCV for Android use standard C ++ support to support native builds on Android Studio 2.2 for Windows?
4
OpenCV Build Source Code for Android
2
for OpenCV Error C ++ build files, but it does not use a supported native build system
2
How to create opencv_contrib module for Android on windows
one
Using an Unoccupied OpenCV Module in Android
one
How to statically link OpenCV with Android AOSP Module?
one
Opencv samples do not work in Android Studio
one
building ndk error for loose opencv modules
0
Error integrating openCV 3.2.0 with Android studio

All Articles