Problem using OpenCV2.3.1 with Android Native Activity
Asked Answered
H

3

14

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.

Hysteresis answered 8/9, 2011 at 10:29 Comment(0)
S
0

Change LOCAL_STATIC_LIBRARIES := android_native_app_glue to LOCAL_STATIC_LIBRARIES += android_native_app_glue. Note the plus sign. This will add the new library without deleting the previously loaded one. Source: Edanna in the comments

Shrieve answered 4/8, 2012 at 1:7 Comment(0)
H
1

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

Hysteresis answered 10/5, 2013 at 7:48 Comment(0)
S
0

Maybe you should take a look at the V4L interface? You might want to check out this thread: http://comments.gmane.org/gmane.comp.handhelds.android.ndk/2824

If I recall you can read directly from a camera's dev file in OpenCV. -James

Shrubby answered 1/11, 2011 at 16:36 Comment(2)
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!!Hysteresis
@Edanna: Why don't you answer yourself and mark the question answered?Howlet
S
0

Change LOCAL_STATIC_LIBRARIES := android_native_app_glue to LOCAL_STATIC_LIBRARIES += android_native_app_glue. Note the plus sign. This will add the new library without deleting the previously loaded one. Source: Edanna in the comments

Shrieve answered 4/8, 2012 at 1:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.