我想添加非自由功能到我的Android應用程序,以便使用SurfFeatureDetector和SurfDescritorExtractor。包括非自由opencv4android
對於這個我遵循this教程,但我第一次有以下錯誤/libnonfree/jni/precomp.hpp:46:30: fatal error: opencv2/cvconfig.h: No such file or directory
可以通過評論包含行解決。
但現在我已經得到了這個錯誤/libnonfree/jni/precomp.hpp:66:42: fatal error: opencv2/ocl/private/util.hpp: No such file or directory
所以我複製了C:\opencv\sources\modules\ocl\include\opencv2\ocl\private
和C:\opencv\sources\modules\ocl\include\opencv2\ocl\cl_runtime
文件夾C:\OpenCV-android-sdk\sdk\native\jni\include\opencv2\ocl\
但現在我得到這些錯誤:
/include/opencv2/ocl/private/util.hpp:65:8: error: 'cl_device_id' does not name a type
/include/opencv2/ocl/private/util.hpp:70:8: error: 'cl_context' does not name a type
/include/opencv2/ocl/private/util.hpp:75:8: error: 'cl_command_queue' does not name a type
... and so on
我使用Cygwin來建立libnonfree並使用它在adroid工作室這裏是我的Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES := on
OPENCV_CAMERA_MODULES := off
include C:\OpenCV-android-sdk\sdk\native\jni\OpenCV.mk
LOCAL_C_INCLUDE := C:\OpenCV-android-sdk\sdk\native\jni\include
LOCAL_SRC_FILES := nonfree_init.cpp sift.cpp surf.cpp
LOCAL_MODULE := nonfree
LOCAL_CFLAGS := -Werror -O3 -ffast-math
LOCAL_LDLIBS := -llog -ldl
include $(BUILD_SHARED_LIBRARY)
有人能解釋我我做錯了什麼? 感謝