Android Programjaim

Android fejlesztes, java, kotlin, web.. miegymas:)

OpenCV emlékeztető, NDK, JNI

2013. január 28. 00:22 - lacas82

Proj properties

C/C++ BUILD->Builder Settings:  ${NDKROOT}/ndk-build.cmd

C/C++ General->Path and Symbols->Includes:

${NDKROOT}/platforms/android-9/arch-arm/usr/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
${ProjDirPath}/../../sdk/native/jni/include

előtte persze Windowsban beállítottuk környezeti változónak az NDKROOT-ot (NDK r8 path)

OpenCV Library 2.4.3 (java+jni->native.so file-ok)

jni/Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

#OPENCV_CAMERA_MODULES:=on
#OPENCV_INSTALL_MODULES:=off
#OPENCV_LIB_TYPE:=SHARED
include ../../sdk/native/jni/OpenCV.mk


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

LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

jni/Aplication.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := all
APP_PLATFORM := android-8

New/Other/C-C++/Convert to C/C++.../Makefile Project/Other ToolChain

vagy:

cmd.exe (nem cygwin)->cd PROJECT->  NDK_PATH/ndk-build  -> .so file-ok megjelennek

ezután CRTL+F11

c++ android log:

#include <android/log.h>

#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))

JNIEXPORT

JNIEXPORT jlong JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_nativeCreateObject

Poénos blog

Címkék: c++ openCV