|
||||||||||
Incorporating Non-Free OpenCV modules like SIFT and SURF in Android OpenCV project ***** from M. Nguyen******** INSTRUCTIONS TO INCORPORATE NON FREE SIFT AND SURF FOR ACADEMIC USE IN OPENCV ANDROID PROJECT I follow the steps below mentioned in the book “Mastering opencv android application” and was able to use SIFT and SUFT methods:
Link download: https://developer.android.com/ndk/downloads/index.html
Link download: https://github.com/opencv/opencv/releases/tag/2.4.13.2 Get sourcecode.zip file, extract it and these files should be under …\ modules\nonfree\src folder.
STEP 2.1 In Android studio INSIDE OF YOUR APPLICATION, create a directory called jni and copy all these to that directory
STEP 2.2 Open precomp.hpp and remove the lines #include "cvconfig.h" and #include "opencv2/ocl/private/util.hpp".
STEP 2.3 Open nonfree_init.cpp and remove the lines of code starting from #ifdef HAVE_OPENCV_OCL and ending at #endif.
LOCAL_PATH := $(call my-dir)
APP_STL := gnustl_static
Here is a screen shot of this folder:
cd <project_directory>/app/src/main/jni
Example- mine is: C:\Users\minhn\OneDrive\Academy\CSU_EastBay\Courses\Computervision_6825\UsingSIFT4\app\src\main\jni
run: <ndk_dir>/ndk-build <ndk_dir> is where you extracted your Android ndk files.
After building successfully, your project would look like this:
, add this line System.loadLibrary("nonfree") under case LoaderCallbackInterface.SUCCESS your code might look like this
@Override
********DONE*******Now we can use those nonfree algorithms of sift and surf we just added in OpenCv. There is also a video on YouTube showing how to handle this task. In this video, instead of building the .so files, he copies those .so from internet and pastes directly to the project. I have not tested it but it seems working and a bit faster: Here is the link: https://www.youtube.com/watch?v=cLK9CjQ-pNI
|
||||||||||
© Lynne Grewe |