Merge pull request #5179 from alalek:update_android_samples
This commit is contained in:
commit
9e065bc802
@ -14,6 +14,7 @@ add_subdirectory(color-blob-detection)
|
||||
add_subdirectory(tutorial-1-camerapreview)
|
||||
add_subdirectory(tutorial-2-mixedprocessing)
|
||||
add_subdirectory(tutorial-3-cameracontrol)
|
||||
add_subdirectory(tutorial-4-opencl)
|
||||
|
||||
# hello-android sample
|
||||
if(HAVE_opencv_highgui)
|
||||
|
@ -5,7 +5,15 @@ include $(CLEAR_VARS)
|
||||
#OPENCV_CAMERA_MODULES:=off
|
||||
#OPENCV_INSTALL_MODULES:=off
|
||||
#OPENCV_LIB_TYPE:=SHARED
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
ifdef OPENCV_ANDROID_SDK
|
||||
ifneq ("","$(wildcard $(OPENCV_ANDROID_SDK)/OpenCV.mk)")
|
||||
include ${OPENCV_ANDROID_SDK}/OpenCV.mk
|
||||
else
|
||||
include ${OPENCV_ANDROID_SDK}/sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
else
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)
|
||||
|
@ -2,7 +2,15 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
ifdef OPENCV_ANDROID_SDK
|
||||
ifneq ("","$(wildcard $(OPENCV_ANDROID_SDK)/OpenCV.mk)")
|
||||
include ${OPENCV_ANDROID_SDK}/OpenCV.mk
|
||||
else
|
||||
include ${OPENCV_ANDROID_SDK}/sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
else
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
|
||||
LOCAL_MODULE := mixed_sample
|
||||
LOCAL_SRC_FILES := jni_part.cpp
|
||||
|
@ -1,4 +1,12 @@
|
||||
set(sample example-tutorial-4-opencl)
|
||||
if(NOT DEFINED ANDROID_OPENCL_SDK)
|
||||
message(STATUS "Sample ${sample} is disabled, because ANDROID_OPENCL_SDK is not specified")
|
||||
return()
|
||||
endif()
|
||||
if(ANDROID_NATIVE_API_LEVEL LESS 14)
|
||||
message(STATUS "Sample ${sample} is disabled, because ANDROID_NATIVE_API_LEVEL < 14")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(native_deps opencv_java)
|
||||
@ -6,7 +14,13 @@ else()
|
||||
set(native_deps opencv_imgproc)
|
||||
endif()
|
||||
|
||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 21 ${ANDROID_SDK_TARGET} NATIVE_DEPS ${native_deps})
|
||||
include_directories(${ANDROID_OPENCL_SDK}/include)
|
||||
link_directories(${ANDROID_OPENCL_SDK}/lib/${ANDROID_ABI})
|
||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
LIBRARY_DEPS ${OpenCV_BINARY_DIR}
|
||||
SDK_TARGET 21 ${ANDROID_SDK_TARGET}
|
||||
NATIVE_DEPS ${native_deps} -lGLESv2 -lEGL -lOpenCL
|
||||
)
|
||||
if(TARGET ${sample})
|
||||
add_dependencies(opencv_android_examples ${sample})
|
||||
endif()
|
||||
|
@ -3,10 +3,18 @@ LOCAL_PATH := $(call my-dir)
|
||||
# add OpenCV
|
||||
include $(CLEAR_VARS)
|
||||
OPENCV_INSTALL_MODULES:=on
|
||||
ifeq ($(O4A_SDK_ROOT),)
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
ifdef OPENCV_ANDROID_SDK
|
||||
ifneq ("","$(wildcard $(OPENCV_ANDROID_SDK)/OpenCV.mk)")
|
||||
include ${OPENCV_ANDROID_SDK}/OpenCV.mk
|
||||
else
|
||||
include ${OPENCV_ANDROID_SDK}/sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
else
|
||||
include $(O4A_SDK_ROOT)/sdk/native/jni/OpenCV.mk
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
endif
|
||||
|
||||
ifndef OPENCL_SDK
|
||||
$(error Specify OPENCL_SDK to Android OpenCL SDK location)
|
||||
endif
|
||||
|
||||
# add OpenCL
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/core/ocl.hpp>
|
||||
|
||||
#include "common.hpp"
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user