在没有OpenCv Package Manager的情况下在Eclipse上创建Android OpenCV项目

时间:2015-08-18 18:49:34

标签: java android c++ eclipse opencv

我在eclipse上寻找一个示例OpenCv Android项目。到目前为止我看到的所有教程:http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization

指向使用OpenCV包管理器。如何在不使用程序包管理器的情况下使用OpenCV库(Java和Native)设置项目?

1 个答案:

答案 0 :(得分:0)

我能够通过在Android.mk中添加以下内容来解决问题:

include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=STATIC 
include ../thirdparty/opencv-android-sdk/sdk/native/jni/OpenCV.mk

然后通过包含opencv_java3库:

if (!OpenCVLoader.initDebug()) {
    // Handle initialization error
    Log.i(TAG, "OpenCVLoader Failed");
} else {
    Log.i(TAG, "OpenCVLoader Succeeded");

    Log.i(TAG, "Loading opencv_java3...");
    java.lang.System.loadLibrary("opencv_java3");
    Log.i(TAG, "Finished Loading opencv_java3...");
}