tutorial-4-opencl: enable build with OpenCV
This commit is contained in:
parent
e1ad86c1fa
commit
03bab0fc0d
@ -14,6 +14,7 @@ add_subdirectory(color-blob-detection)
|
|||||||
add_subdirectory(tutorial-1-camerapreview)
|
add_subdirectory(tutorial-1-camerapreview)
|
||||||
add_subdirectory(tutorial-2-mixedprocessing)
|
add_subdirectory(tutorial-2-mixedprocessing)
|
||||||
add_subdirectory(tutorial-3-cameracontrol)
|
add_subdirectory(tutorial-3-cameracontrol)
|
||||||
|
add_subdirectory(tutorial-4-opencl)
|
||||||
|
|
||||||
# hello-android sample
|
# hello-android sample
|
||||||
if(HAVE_opencv_highgui)
|
if(HAVE_opencv_highgui)
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
set(sample example-tutorial-4-opencl)
|
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)
|
if(BUILD_FAT_JAVA_LIB)
|
||||||
set(native_deps opencv_java)
|
set(native_deps opencv_java)
|
||||||
@ -6,7 +14,13 @@ else()
|
|||||||
set(native_deps opencv_imgproc)
|
set(native_deps opencv_imgproc)
|
||||||
endif()
|
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})
|
if(TARGET ${sample})
|
||||||
add_dependencies(opencv_android_examples ${sample})
|
add_dependencies(opencv_android_examples ${sample})
|
||||||
endif()
|
endif()
|
||||||
|
@ -13,6 +13,10 @@ else
|
|||||||
include ../../sdk/native/jni/OpenCV.mk
|
include ../../sdk/native/jni/OpenCV.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef OPENCL_SDK
|
||||||
|
$(error Specify OPENCL_SDK to Android OpenCL SDK location)
|
||||||
|
endif
|
||||||
|
|
||||||
# add OpenCL
|
# add OpenCL
|
||||||
LOCAL_C_INCLUDES += $(OPENCL_SDK)/include
|
LOCAL_C_INCLUDES += $(OPENCL_SDK)/include
|
||||||
LOCAL_LDLIBS += -L$(OPENCL_SDK)/lib/$(TARGET_ARCH_ABI) -lOpenCL
|
LOCAL_LDLIBS += -L$(OPENCL_SDK)/lib/$(TARGET_ARCH_ABI) -lOpenCL
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/core.hpp>
|
||||||
|
#include <opencv2/imgproc.hpp>
|
||||||
#include <opencv2/core/ocl.hpp>
|
#include <opencv2/core/ocl.hpp>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#include <GLES2/gl2ext.h>
|
#include <GLES2/gl2ext.h>
|
||||||
|
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/core.hpp>
|
||||||
|
#include <opencv2/imgproc.hpp>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user