LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := cxcore
LOCAL_SRC_FILES := cxconvert.cpp \
cxflann.cpp\
cxpersistence.cpp\
cxcopy.cpp\
cximage.cpp\
cxprecomp.cpp\
cxlapack.cpp\
cxrand.cpp\
cxalloc.cpp\
cxdatastructs.cpp\
cxmathfuncs.cpp\
cxstat.cpp\
cxarithm.cpp\
cxdrawing.cpp\
cxmatmul.cpp\
cxsystem.cpp\
cxarray.cpp\
cxdxt.cpp\
cxmatrix.cpp\
cxtables.cpp
LOCAL_CXXFLAGS := -D_GLIBCXX_USE_WCHAR_T
LOCAL_CXXFLAGS += -I../../../include/opencv/ -I../../../3rdparty/flann/ -I../../../3rdparty/include/
include $(BUILD_SHARED_LIBRARY)
/home/sam/work/current/AM/Thirdparty/OpenCV/OpenCV-2.0/Linux_Version/OpenCV-2.0.0/src/cxcore/jni/cxlapack.cpp:759:9: error: expected unqualified-id before numeric constant
/home/sam/work/current/AM/Thirdparty/OpenCV/OpenCV-2.0/Linux_Version/OpenCV-2.0.0/src/cxcore/jni/cxlapack.cpp:760:18: error: no matching function for call to 'cv::Mat::copyTo(int) const'
Sam將 _S 全部修改爲 _S1即可。
Mat _S1(_S0.size(), _S0.type(), S);
doesn't respect namespace scopes. Therefore such names should
generally be avoided for everything else.
$mkdir jni
copy all cpp and .h file to jni
create Application.mk and android.mk
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := flann
LOCAL_SRC_FILES := constants.h\
flann.cpp\
flann.hpp\
dist.cpp\
index_testing.cpp\
logger.cpp\
random.cpp\
saving.cpp
LOCAL_CXXFLAGS := -D_GLIBCXX_USE_WCHAR_T
LOCAL_CXXFLAGS += -I../../include/flann/ -I../util/ -I../nn -I../algorithms
#include $(BUILD_EXECUTABLE)
include $(BUILD_SHARED_LIBRARY)
再次編譯cxcore,又報錯:
/home/sam/work/current/AM/Thirdparty/OpenCV/OpenCV-2.0/Linux_Version/OpenCV-2.0.0/src/cxcore/jni/cxpersistence.cpp:257: error: undefined reference to 'gzclose'
/home/sam/work/current/AM/Thirdparty/OpenCV/OpenCV-2.0/Linux_Version/OpenCV-2.0.0/src/cxcore/jni/cxpersistence.cpp:233: error: undefined reference to 'gzputs'
查找之,發現是3rdparty/zlib沒有編譯。編譯之。
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := cxcore
LOCAL_SRC_FILES := cxconvert.cpp \
cxflann.cpp\
cxpersistence.cpp\
cxcopy.cpp\
cximage.cpp\
cxprecomp.cpp\
cxlapack.cpp\
cxrand.cpp\