在Android应用开发中使用OpenCV和NDK

时间:2014-07-21 08:24:28

标签: android opencv android-ndk

我正在使用facedetectionAndroid上测试NDK计划。我遵循了所有讨论here。我将OpenCV'sarmeabi内的所有armeabi-v7a库文件复制到我的project libs folder中。然后我的Android.mk更新为

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_INSTALL_MODULES  :=  on
OPENCV_CAMERA_MODULES   :=  off
OPENCV_LIB_TYPE         :=  STATIC
include C:\adt-bundle-windows-x86\OpenCV-2.4.9-android-sdk\sdk\native\jni\OpenCV.mk

LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl

LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

然后我转到命令窗口并输入

C:\facedetection\jni\include>javah -classpath ../../bin/classes;C:
\adt-bundle-windows-x86\sdk\platforms\android-18\android.jar -o DetectionBas
edTracker_jni.h org.opencv.samples.facedetect.FdActivity
Error: Class org.opencv.android.CameraBridgeViewBase could not be found.

然后错误为Class org.opencv.android.CameraBridgeViewBase could not be found。 这个错误的原因是什么? 感谢

1 个答案:

答案 0 :(得分:1)

您提供了错误的\斜杠。您需要使用此/斜杠。

请更改以下内容

include C:\adt-bundle-windows-x86\OpenCV-2.4.9-android-sdk\sdk\native\jni\OpenCV.mk

include C:/adt-bundle-windows-x86/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk