Issue
I am currently working on an android app which involves the Canny Edge Detection. I decided to use the opencv library which is much faster than using Java. So I placed the libopencv_java.so files in their respective directories. It worked but it resulted in huge apk size. I don't know much of C++ language. Is it possible to generate the libopencv_java.so file which include only the required components for edge detection in order to reduce the apk size?
If yes, how?
Otherwise please suggest other fast and smaller libraries to perform Canny Edge Detection in android.
Solution
You can build lib for android using the method mentioned here.
https://zami0xzami.wordpress.com/2016/03/17/building-opencv-for-android-from-source/
I guess you are using JNI to implement you work and you must be using opencv-Android-sdk.
If you are using static library copy only required lib to../OpenCV-3.1.0-android-sdk1/sdk/native/libs/(Target-abi folder).
2.If you are using shared one then you will need libopencv_java.So for reducing the size, remove unrequired lib from libopencv_java.so.To remove this lib go to /opencv/modules/MODULE_NAME/CMakeLists.txt find a line ocv_define_module(imgproc opencv_core WRAP java python) and remove java from this line.
As far I know canny edge is a part of either imgproc or core or highgui. So modify cmakelists of all modules except these. Now build lib using the method in link (given at the starting of post).Copy new lib to sdk folder.
Answered By - Garvita Tiwari
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.