Compiling openCV for Android and creating a dynamic library

I am encoding an Android application that uses openCV to process the camera. I use native C ++ code. Everything worked fine until I tried to use cv :: motempl, since it is not part of the kernel, but part of the modules.

I downloaded opencv, opencv_contrib and android-ndk-r16b to compile the modules. I managed to compile everything for my architecture (armeabi-v7a), but I only get static libraries (compiled with -fPic, though).

I tried to link all my .a with libopencv_java3.so I need the following line:

~/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -shared -o libopencv_java3.so --sysroot=~/Android/android-ndk-r16b/platforms/android-23/arch-arm/ -L. -lopencv_aruco -lopencv_etc...

But the .so file I get does not contain the characters of my static libs (this looks like 6140 bytes, and Android Studio complains about undefined links).

What am I doing wrong?

+4
source share

Source: https://habr.com/ru/post/1693779/


All Articles