I am having trouble figuring out solutions to these problems. I thought I would find the appropriate question and answer the community if others are also looking for solutions to problems like this and mine. Compilation was done on the Macbook Retina 13 ".
The instructions provided are somewhat incomplete, and additional steps are required to obtain the final product.
In the beginning, you will follow the standard procedure described on the Internet.
$ cd <opecv_directory> $ mkdir build $ cd <opencv_build_directory> $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory> $ make -j5 $ make install
In addition to this, you may encounter an error or two errors. I needed to install some missing components in order to get past things that were missing, but this may be different for you (I investigated the errors and realized that I needed additional components)
brew install ninja brew install oxygen brew install ant
I also ran into a bug with one module asking for the following declaration in the source code (or with compiler flags):
#define SOLARIS_64BIT_ENABLED
Another thing you can do is remove other modules in the contrib folder that may not be of interest at compile time. Just turn on the modules you want and hopefully those that are good. I did this simply by deleting one or two from the / modules folder and then re-running the python script.
To start the assembly, you need the final python script. I created a directory next to the main source tree and the contrib folder.
OpenCVSource -> opencv -> opencv_contrib -> android_opencv_build
The call below was made from the directory in which I want the assembly to run, so I went to the directory. The challenge was as follows:
python ../opencv/platforms/android/build_sdk.py
This only creates the .so files needed to use the library, but does not create the .jar file that you will need to use the new binaries. To do this, go to your build folder (mine, as you can see, in android_opencv_build / OpenCV-android-sdk)
Download this project in Eclipse in the standard way by importing an existing Android project into the workspace. You really only need the / sdk project, but if you want, you can also download samples. Then create a project. You may need to change the target assembly to support the new camera APIs for a successful assembly; in my case, changing the target to API level 21.
Then you will find the .jar file in the / bin directory of the project. The .jar and .so files found in the file android_opencv_build / OpenCV-android-sdk / sdk / native / jni / contain the necessary .so files that you will need to add to the project / lib folder next to this jar.
You should now have everything you need. Since we work with Contrib modules (or not, if you build it for other reasons), it is possible that you will encounter other errors during the assembly process that are not stable enough and require some attention. This may not help, but people are free to add comments to other people's decisions and this post to help them solve them if they find a solution.