Ask Your Question
1

OpenCV build options, big difference in speed after android library linking

asked 2014-05-31 08:49:11 -0600

target33 gravatar image

Hi, Until now I used OpenCV4Android coupled with the opencv manager to experiment with ORB features performance on android devices. Now I need to modify an opencv function (for testing) so I switched to OpenCVLoader.initDebug() interface (instead of OpenCVLoader.initAsync()), by linking "libopencv_java.so" inside android project libs. Everything works fine as expected (currently I've done no changes to opencv source yet).

The only problem regards speed. No matter which options I use to compile opencv from trunk, if I link libopencv_java.so from my opencv build, I get almost half the framerate from my feature detector android program. To be sure it wasn't my fault, I extracted "libopencv_java.so" from apk file inside OpenCV4Android SDK (exactly, I extracted it from OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk which is mainly a zip file) and linked it to my android program (no changes made, only linking with extracted libopencv_java.so). Doing this I get full speed back. It seems that the build options of the openCV manager optimize the code same way..

The question is: which options have been used to build opencv manager? Or better, the libraries used during Manager compilation? Currently, the options used to build OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk? I tried any option available (I think), especially the NEON ones, with no improvement. Also, if I link libopencv_java.so obtained from "OpenCV-2.4.9-android-sdk\sdk\native\libs\armeabi-v7a\" I get the same issue, so this means that opencv manager has been compiled with different options.

As additional note, if I install opencv manager from play store, it says my device uses armeabi-v7a with NEON.

These are the options I tried so far compiling "cmake_android_arm.sh" from latest repository (I'm using Ubuntu):

CMAKE_BUILD_TYPE=Release BUILD_SHARED_LIBS=OFF ENABLE_VFPV3=ON ENABLE_NEON=ON USE_NEON=ON ANDOID_ABI="armeabi-v7a with NEON" ANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.6" WITH_TBB=ON BUILD_TBB=ON ANDROID_NATIVE_API_LEVEL=19

I need to know with options have been used to compile the library used in opencv manager. I don't need to recompile the manager, only to recompile libopencv_java.so the same way.

Thanks,

Massimo

P.S. maybe has intel IPP been installed and used inside library building? This is the only thing I didn't try yet...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-06-01 03:41:35 -0600

There is special OpenCV version targeted for Tegra SoC. It is closed source, provided by NVIDIA and distributed via OpenCV Manager. OpenCV for Tegra is optimized version of OpenCV and looks like OpenCV Manager provides it to you. In case of self-built binary you use general OpenCV code, no NVIDIA specific optimizations. Here is NVIDIA page about TADP and OpenCV for Tegra included.

edit flag offensive delete link more

Comments

Hi, thanks for the answer. Are those NVIDIA optimization also acting on non-Tegra SoC? Because currently I'm developing on a Galaxy S2 device and as far as I know, it doesn't have a Tegra SoC..

target33 gravatar imagetarget33 ( 2014-06-01 04:36:51 -0600 )edit

No, It's not. Also such performance improvements can be result of TBB usage and some compiler flags that turn on automatic vectorization or some other indirect improvements.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2014-06-04 12:42:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-05-31 08:49:11 -0600

Seen: 2,388 times

Last updated: Jun 01 '14