Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem using OpenCV2.3.1 with Android Native Activity

i'm developing a computer vision application for Android. That work involves getting camera frames as fast as possible, so I'm trying to build a android application directly in c++ using "android_native_app_glue" and "libnative_camera" to get camera frames. It seems to be incompatible.

I tested out 2 options.

  1. I tried to use OpenCV on the android NDK sample "NativeActivity", just make the few necessary changes (convert sample to c++, modify android.mk y application.mk and including using namespaces and includes) It gives the following error:

sharedLibrary : libnative-activity.so C:/Development/android-opencv-wsp/samples/native-activity/obj/local/armeabi-v7a/objs/native-activity/main.o: In function ~Mat': C:\Development\android-opencv-wsp\samples\native-activity/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference tocv::fastFree(void*)' and so on

  1. I tried to import the necessary libraries to make a native activity on the OpenCV2.3.1 tutorial 3 sample. I simply modified the Android.mk and added:

LOCAL_STATIC_LIBRARIES := android_native_app_glue

Immediately, when I add this line, I get the following error: SharedLibrary : libnative_sample.so C:/Development/android-opencv-wsp/samples/tutorial-3-native/obj/local/armeabi-v7a/objs/native_sample/jni_part.o: In function ~Mat': C:\Development\android-opencv-wsp\samples\tutorial-3-native/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference tocv::fastFree(void*)' and so on...

Please, has anyone tested a purely native activity with openCV2.3.1 and libnative_camera to get camera frames?

Thanks in advance.

like image 338
Edanna Avatar asked Sep 08 '11 10:09

Edanna


1 Answers

I solved the problem there. It was my fault (as usual xD) the problem was I was writting in my Android.mk this line: LOCAL_STATIC_LIBRARIES := android_native_app_glue, instead of this line: LOCAL_STATIC_LIBRARIES += android_native_app_glue. I needed the "plus" symbol, in order to add the new library and not deleting the previously loaded. Thanks anyway!!

@Adi Shavit - thx

like image 117
Edanna Avatar answered Oct 26 '22 22:10

Edanna