Le Duy Khanh
Le Duy Khanh

Reputation: 1369

ndk build with opencv

i'm building an cpp file that uses opencv library. I include cv.h and my Application.mk got

LOCAL_LDLIBS := "C:\OpenCV2.1\lib\cxcore210.lib" "C:\OpenCV2.1\lib\highgui210.lib" "C:\OpenCV2.1\lib\cvaux210.lib"  "C:\taucs_full\lib\win32\libtaucs.lib"

but i cannot call any function , for example cvSaveImage. I looked through opencv directory and try to find cpp file that implements those functions but cannot find. So how can I do it?

Upvotes: 0

Views: 586

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57203

Your LOCAL_LDLIBS lists the Windows versions of OpenCV libraries (how do I know? Because they have .lib extension). To build your Android native library, you should first build OpenCV for Android, using NDK and its gcc toolchain. This will produce files like libcxcore210.a, etc. You will add these files to LOCAL_LDLIBS (note that lib and .a are concealed):

LOCAL_LDLIBS += -Lc:/opencv2.1/libandroid -lcxcore210 -lhighgui210 -lcvaux210

Note also, that this definition should be put in Android.mk file, not Application.mk!

Upvotes: 1

Related Questions