在 Android Native Activity 中使用 OpenCV2.3.1 时出现问题
我正在为 Android 开发一个计算机视觉应用程序。 这项工作涉及尽可能快地获取相机帧,因此我尝试使用“android_native_app_glue”和“libnative_camera”直接在 C++ 中构建一个 Android 应用程序来获取相机帧。 似乎不兼容。
我测试了 2 个选项。
- 我尝试在 android NDK 示例“NativeActivity”上使用 OpenCV,只需进行一些必要的更改(将示例转换为 c++,修改 android.mk y application.mk 并包括使用命名空间和包含)它给出以下错误:
sharedLibrary:libnative -活动.so C:/Development/android-opencv-wsp/samples/native-activity/obj/local/armeabi-v7a/objs/native-activity/main.o:在函数 ~Mat' 中: C:\Development\android-opencv-wsp\samples\native-activity/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297 :对 cv::fastFree(void*)' 的未定义引用 等等
- 我尝试导入必要的库以在 OpenCV2.3.1 教程 3 示例上进行本机活动。我只是修改了 Android.mk 并添加了:
LOCAL_STATIC_LIBRARIES := android_native_app_glue
立即,当我添加此行时,出现以下错误: 共享库:libnative_sample.so C:/Development/android-opencv-wsp/samples/tutorial-3-native/obj/local/armeabi-v7a/objs/native_sample/jni_part.o:在函数 ~Mat' 中: C:\Development\android-opencv-wsp\samples\tutorial-3-native/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp :297: 对 cv::fastFree(void*)' 的未定义引用 等等...
请问,有人用 openCV2.3.1 和 libnative_camera 测试过纯本机活动来获取相机帧吗?
提前致谢。
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.
- 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':
cv::fastFree(void*)'
C:\Development\android-opencv-wsp\samples\native-activity/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference to
and so on
- 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':
cv::fastFree(void*)'
C:\Development\android-opencv-wsp\samples\tutorial-3-native/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference to
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在那里解决了问题。这是我的错(像往常一样 xD),问题是我在 Android.mk 中写入了这一行:LOCAL_STATIC_LIBRARIES := android_native_app_glue,而不是这一行:LOCAL_STATIC_LIBRARIES += android_native_app_glue。我需要“加号”符号,以便添加新库而不删除以前加载的库。无论如何谢谢!!
@Adi Shavit - 谢谢
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
将 LOCAL_STATIC_LIBRARIES := android_native_app_glue 更改为 LOCAL_STATIC_LIBRARIES += android_native_app_glue。注意加号。这将添加新的库,而不删除先前加载的库。来源:评论中的 Edanna
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
也许你应该看一下 V4L 接口?您可能想查看此线程:http://comments.gmane。 org/gmane.comp.handhelds.android.ndk/2824
如果我记得你可以直接从 OpenCV 中的相机开发文件中读取。
——詹姆斯
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