Merge branch 'master' into python2and3
This commit is contained in:
commit
3d0a270a66
@ -337,6 +337,9 @@ if(DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB AND BUILD_SHARED_LIBS AND NOT DEFINED BUILD_opencv_world)
|
||||
set(BUILD_opencv_world ON CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Path for build/platform -specific headers
|
||||
@ -554,7 +557,6 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
# Finalization: generate configuration-based files
|
||||
# ----------------------------------------------------------------------------
|
||||
ocv_track_build_dependencies()
|
||||
|
||||
# Generate platform-dependent and configuration-dependent headers
|
||||
include(cmake/OpenCVGenHeaders.cmake)
|
||||
|
@ -6,18 +6,18 @@ if(NOT OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
|
||||
project(traincascade)
|
||||
set(the_target opencv_traincascade)
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${OPENCV_TRAINCASCADE_DEPS})
|
||||
ocv_target_include_directories(${the_target} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_target_include_modules(${the_target} ${OPENCV_TRAINCASCADE_DEPS})
|
||||
|
||||
file(GLOB SRCS *.cpp)
|
||||
file(GLOB HDRS *.h*)
|
||||
|
||||
set(traincascade_files ${SRCS} ${HDRS})
|
||||
|
||||
set(the_target opencv_traincascade)
|
||||
add_executable(${the_target} ${traincascade_files})
|
||||
target_link_libraries(${the_target} ${OPENCV_TRAINCASCADE_DEPS})
|
||||
ocv_add_executable(${the_target} ${traincascade_files})
|
||||
ocv_target_link_libraries(${the_target} ${OPENCV_TRAINCASCADE_DEPS})
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
|
@ -280,9 +280,6 @@ macro(add_android_project target path)
|
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}")
|
||||
|
||||
if(JNI_LIB_NAME)
|
||||
ocv_include_modules_recurse(${android_proj_NATIVE_DEPS})
|
||||
ocv_include_directories("${path}/jni")
|
||||
|
||||
if(NATIVE_APP_GLUE)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
@ -291,7 +288,9 @@ macro(add_android_project target path)
|
||||
endif()
|
||||
|
||||
add_library(${JNI_LIB_NAME} MODULE ${android_proj_jni_files})
|
||||
target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
ocv_target_include_modules_recurse(${JNI_LIB_NAME} ${android_proj_NATIVE_DEPS})
|
||||
ocv_target_include_directories(${JNI_LIB_NAME} "${path}/jni")
|
||||
ocv_target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES
|
||||
OUTPUT_NAME "${JNI_LIB_NAME}"
|
||||
|
@ -6,16 +6,19 @@
|
||||
# Global variables:
|
||||
#
|
||||
# OPENCV_MODULE_${the_module}_LOCATION
|
||||
# OPENCV_MODULE_${the_module}_BINARY_DIR
|
||||
# OPENCV_MODULE_${the_module}_DESCRIPTION
|
||||
# OPENCV_MODULE_${the_module}_CLASS - PUBLIC|INTERNAL|BINDINGS
|
||||
# OPENCV_MODULE_${the_module}_HEADERS
|
||||
# OPENCV_MODULE_${the_module}_SOURCES
|
||||
# OPENCV_MODULE_${the_module}_DEPS - final flattened set of module dependencies
|
||||
# OPENCV_MODULE_${the_module}_DEPS_TO_LINK - differs from above for world build only
|
||||
# OPENCV_MODULE_${the_module}_DEPS_EXT - non-module dependencies
|
||||
# OPENCV_MODULE_${the_module}_REQ_DEPS
|
||||
# OPENCV_MODULE_${the_module}_OPT_DEPS
|
||||
# OPENCV_MODULE_${the_module}_PRIVATE_REQ_DEPS
|
||||
# OPENCV_MODULE_${the_module}_PRIVATE_OPT_DEPS
|
||||
# OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD
|
||||
# HAVE_${the_module} - for fast check of module availability
|
||||
|
||||
# To control the setup of the module you could also set:
|
||||
@ -53,6 +56,7 @@ foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MOD
|
||||
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_OPT_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_LINK_DEPS CACHE)
|
||||
endforeach()
|
||||
|
||||
# clean modules info which needs to be recalculated
|
||||
@ -61,6 +65,7 @@ set(OPENCV_MODULES_BUILD "" CACHE INTERNAL "List of OpenCV modules incl
|
||||
set(OPENCV_MODULES_DISABLED_USER "" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
|
||||
set(OPENCV_MODULES_DISABLED_AUTO "" CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
|
||||
set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules which can not be build in current configuration")
|
||||
unset(OPENCV_WORLD_MODULES CACHE)
|
||||
|
||||
# adds dependencies to OpenCV module
|
||||
# Usage:
|
||||
@ -68,6 +73,7 @@ set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules whic
|
||||
# Notes:
|
||||
# * <list of dependencies> - can include full names of modules or full pathes to shared/static libraries or cmake targets
|
||||
macro(ocv_add_dependencies full_modname)
|
||||
ocv_debug_message("ocv_add_dependencies(" ${full_modname} ${ARGN} ")")
|
||||
#we don't clean the dependencies here to allow this macro several times for every module
|
||||
foreach(d "REQUIRED" ${ARGN})
|
||||
if(d STREQUAL "REQUIRED")
|
||||
@ -105,6 +111,7 @@ endmacro()
|
||||
# Example:
|
||||
# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui opencv_flann OPTIONAL opencv_cuda)
|
||||
macro(ocv_add_module _name)
|
||||
ocv_debug_message("ocv_add_module(" ${_name} ${ARGN} ")")
|
||||
string(TOLOWER "${_name}" name)
|
||||
string(REGEX REPLACE "^opencv_" "" ${name} "${name}")
|
||||
set(the_module opencv_${name})
|
||||
@ -134,6 +141,8 @@ macro(ocv_add_module _name)
|
||||
set(OPENCV_MODULE_${the_module}_DESCRIPTION "${the_description}" CACHE INTERNAL "Brief description of ${the_module} module")
|
||||
set(OPENCV_MODULE_${the_module}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources")
|
||||
|
||||
set(OPENCV_MODULE_${the_module}_LINK_DEPS "" CACHE INTERNAL "")
|
||||
|
||||
# parse list of dependencies
|
||||
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The category of the module")
|
||||
@ -150,8 +159,14 @@ macro(ocv_add_module _name)
|
||||
endif()
|
||||
|
||||
# add self to the world dependencies
|
||||
if(NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS" OR OPENCV_MODULE_IS_PART_OF_WORLD)
|
||||
if((NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS"
|
||||
AND NOT OPENCV_PROCESSING_EXTRA_MODULES)
|
||||
OR OPENCV_MODULE_IS_PART_OF_WORLD
|
||||
)
|
||||
set(OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD ON CACHE INTERNAL "")
|
||||
ocv_add_dependencies(opencv_world OPTIONAL ${the_module})
|
||||
else()
|
||||
set(OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
if(BUILD_${the_module})
|
||||
@ -164,12 +179,15 @@ macro(ocv_add_module _name)
|
||||
|
||||
# stop processing of current file
|
||||
return()
|
||||
else(OPENCV_INITIAL_PASS)
|
||||
else()
|
||||
set(OPENCV_MODULE_${the_module}_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "")
|
||||
if(NOT BUILD_${the_module})
|
||||
return() # extra protection from redefinition
|
||||
endif()
|
||||
project(${the_module})
|
||||
endif(OPENCV_INITIAL_PASS)
|
||||
if((NOT OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD AND NOT ${the_module} STREQUAL opencv_world) OR NOT ${BUILD_opencv_world})
|
||||
project(${the_module})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# excludes module from current configuration
|
||||
@ -200,7 +218,11 @@ macro(ocv_glob_modules)
|
||||
|
||||
# collect modules
|
||||
set(OPENCV_INITIAL_PASS ON)
|
||||
set(OPENCV_PROCESSING_EXTRA_MODULES 0)
|
||||
foreach(__path ${ARGN})
|
||||
if("${__path}" STREQUAL "EXTRA")
|
||||
set(OPENCV_PROCESSING_EXTRA_MODULES 1)
|
||||
endif()
|
||||
get_filename_component(__path "${__path}" ABSOLUTE)
|
||||
|
||||
list(FIND __directories_observed "${__path}" __pathIdx)
|
||||
@ -222,16 +244,7 @@ macro(ocv_glob_modules)
|
||||
endif()
|
||||
list(APPEND __directories_observed "${__modpath}")
|
||||
|
||||
if(OCV_MODULE_RELOCATE_ON_INITIAL_PASS)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
file(COPY "${__modpath}/CMakeLists.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
set(OPENCV_MODULE_opencv_${mod}_LOCATION "${__modpath}" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
endif()
|
||||
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@ -244,15 +257,31 @@ macro(ocv_glob_modules)
|
||||
# create modules
|
||||
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
|
||||
set(OPENCV_INITIAL_PASS OFF)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(m MATCHES "^opencv_")
|
||||
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
||||
else()
|
||||
message(WARNING "Check module name: ${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${m}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(${BUILD_opencv_world})
|
||||
add_subdirectory("${OPENCV_MODULE_opencv_world_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/world")
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(NOT OPENCV_MODULE_${m}_IS_PART_OF_WORLD AND NOT ${m} STREQUAL opencv_world)
|
||||
message(STATUS "Processing module ${m}...")
|
||||
if(m MATCHES "^opencv_")
|
||||
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
||||
else()
|
||||
message(WARNING "Check module name: ${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${m}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(m MATCHES "^opencv_")
|
||||
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
||||
else()
|
||||
message(WARNING "Check module name: ${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${m}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(__shortname)
|
||||
endmacro()
|
||||
|
||||
@ -394,11 +423,36 @@ function(__ocv_resolve_dependencies)
|
||||
__ocv_sort_modules_by_deps(OPENCV_MODULE_${m}_DEPS)
|
||||
ocv_list_sort(OPENCV_MODULE_${m}_DEPS_EXT)
|
||||
|
||||
set(LINK_DEPS ${OPENCV_MODULE_${m}_DEPS})
|
||||
|
||||
# process world
|
||||
if(BUILD_opencv_world)
|
||||
if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
|
||||
list(APPEND OPENCV_WORLD_MODULES ${m})
|
||||
endif()
|
||||
foreach(m2 ${OPENCV_MODULES_BUILD})
|
||||
if(OPENCV_MODULE_${m2}_IS_PART_OF_WORLD)
|
||||
if(";${LINK_DEPS};" MATCHES ";${m2};")
|
||||
list(REMOVE_ITEM LINK_DEPS ${m2})
|
||||
if(NOT (";${LINK_DEPS};" MATCHES ";opencv_world;") AND NOT (${m} STREQUAL opencv_world))
|
||||
list(APPEND LINK_DEPS opencv_world)
|
||||
endif()
|
||||
endif()
|
||||
if(${m} STREQUAL opencv_world)
|
||||
list(APPEND OPENCV_MODULE_opencv_world_DEPS_EXT ${OPENCV_MODULE_${m2}_DEPS_EXT})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module")
|
||||
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module")
|
||||
set(OPENCV_MODULE_${m}_DEPS_TO_LINK ${LINK_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module (for linker)")
|
||||
|
||||
# message(STATUS " module deps: ${OPENCV_MODULE_${m}_DEPS}")
|
||||
# message(STATUS " extra deps: ${OPENCV_MODULE_${m}_DEPS_EXT}")
|
||||
# message(STATUS " module deps of ${m}: ${OPENCV_MODULE_${m}_DEPS}")
|
||||
# message(STATUS " module link deps of ${m}: ${OPENCV_MODULE_${m}_DEPS_TO_LINK}")
|
||||
# message(STATUS " extra deps of ${m}: ${OPENCV_MODULE_${m}_DEPS_EXT}")
|
||||
# message(STATUS "")
|
||||
endforeach()
|
||||
|
||||
__ocv_sort_modules_by_deps(OPENCV_MODULES_BUILD)
|
||||
@ -406,6 +460,7 @@ function(__ocv_resolve_dependencies)
|
||||
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export")
|
||||
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} CACHE INTERNAL "List of OpenCV modules included into the build")
|
||||
set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
|
||||
set(OPENCV_WORLD_MODULES ${OPENCV_WORLD_MODULES} CACHE INTERNAL "List of OpenCV modules included into the world")
|
||||
endfunction()
|
||||
|
||||
|
||||
@ -422,18 +477,31 @@ macro(ocv_include_modules)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# setup include paths for the list of passed modules and recursively add dependent modules
|
||||
macro(ocv_include_modules_recurse)
|
||||
# setup include paths for the list of passed modules
|
||||
macro(ocv_target_include_modules target)
|
||||
foreach(d ${ARGN})
|
||||
if(d MATCHES "^opencv_" AND HAVE_${d})
|
||||
if (EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
ocv_include_directories("${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
endif()
|
||||
if(OPENCV_MODULE_${d}_DEPS)
|
||||
ocv_include_modules(${OPENCV_MODULE_${d}_DEPS})
|
||||
ocv_target_include_directories(${target} "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
endif()
|
||||
elseif(EXISTS "${d}")
|
||||
ocv_include_directories("${d}")
|
||||
ocv_target_include_directories(${target} "${d}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# setup include paths for the list of passed modules and recursively add dependent modules
|
||||
macro(ocv_target_include_modules_recurse target)
|
||||
foreach(d ${ARGN})
|
||||
if(d MATCHES "^opencv_" AND HAVE_${d})
|
||||
if (EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
ocv_target_include_directories(${target} "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
endif()
|
||||
if(OPENCV_MODULE_${d}_DEPS)
|
||||
ocv_target_include_modules(${target} ${OPENCV_MODULE_${d}_DEPS})
|
||||
endif()
|
||||
elseif(EXISTS "${d}")
|
||||
ocv_target_include_directories(${target} "${d}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
@ -441,11 +509,12 @@ endmacro()
|
||||
# setup include path for OpenCV headers for specified module
|
||||
# ocv_module_include_directories(<extra include directories/extra include modules>)
|
||||
macro(ocv_module_include_directories)
|
||||
ocv_include_directories("${OPENCV_MODULE_${the_module}_LOCATION}/include"
|
||||
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for precompiled headers
|
||||
)
|
||||
ocv_include_modules(${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
||||
ocv_target_include_directories(${the_module}
|
||||
"${OPENCV_MODULE_${the_module}_LOCATION}/include"
|
||||
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for precompiled headers
|
||||
)
|
||||
ocv_target_include_modules(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
||||
endmacro()
|
||||
|
||||
|
||||
@ -454,6 +523,8 @@ endmacro()
|
||||
# Usage:
|
||||
# ocv_set_module_sources([HEADERS] <list of files> [SOURCES] <list of files>)
|
||||
macro(ocv_set_module_sources)
|
||||
ocv_debug_message("ocv_set_module_sources(" ${ARGN} ")")
|
||||
|
||||
set(OPENCV_MODULE_${the_module}_HEADERS "")
|
||||
set(OPENCV_MODULE_${the_module}_SOURCES "")
|
||||
|
||||
@ -481,31 +552,50 @@ endmacro()
|
||||
# Usage:
|
||||
# ocv_glob_module_sources([EXCLUDE_CUDA] <extra sources&headers in the same format as used in ocv_set_module_sources>)
|
||||
macro(ocv_glob_module_sources)
|
||||
ocv_debug_message("ocv_glob_module_sources(" ${ARGN} ")")
|
||||
set(_argn ${ARGN})
|
||||
list(FIND _argn "EXCLUDE_CUDA" exclude_cuda)
|
||||
if(NOT exclude_cuda EQUAL -1)
|
||||
list(REMOVE_AT _argn ${exclude_cuda})
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE lib_srcs "src/*.cpp")
|
||||
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h")
|
||||
file(GLOB lib_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
||||
file(GLOB_RECURSE lib_srcs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE lib_int_hdrs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.h"
|
||||
)
|
||||
file(GLOB lib_hdrs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
|
||||
)
|
||||
file(GLOB lib_hdrs_detail
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/detail/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/detail/*.h"
|
||||
)
|
||||
if (APPLE)
|
||||
file(GLOB_RECURSE lib_srcs_apple
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.mm"
|
||||
)
|
||||
list(APPEND lib_srcs ${lib_srcs_apple})
|
||||
endif()
|
||||
|
||||
ocv_source_group("Src" DIRBASE "${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
ocv_source_group("Include" DIRBASE "${CMAKE_CURRENT_SOURCE_DIR}/include" FILES ${lib_hdrs} ${lib_hdrs_detail})
|
||||
ocv_source_group("Src" DIRBASE "${CMAKE_CURRENT_LIST_DIR}/src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
ocv_source_group("Include" DIRBASE "${CMAKE_CURRENT_LIST_DIR}/include" FILES ${lib_hdrs} ${lib_hdrs_detail})
|
||||
|
||||
if (exclude_cuda EQUAL -1)
|
||||
file(GLOB lib_cuda_srcs "src/cuda/*.cu")
|
||||
file(GLOB lib_cuda_srcs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/cuda/*.cu"
|
||||
)
|
||||
set(cuda_objs "")
|
||||
set(lib_cuda_hdrs "")
|
||||
if(HAVE_CUDA)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp")
|
||||
file(GLOB lib_cuda_hdrs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/cuda/*.hpp"
|
||||
)
|
||||
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
@ -516,17 +606,19 @@ macro(ocv_glob_module_sources)
|
||||
set(lib_cuda_hdrs "")
|
||||
endif()
|
||||
|
||||
file(GLOB cl_kernels "src/opencl/*.cl")
|
||||
file(GLOB cl_kernels
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/opencl/*.cl"
|
||||
)
|
||||
if(cl_kernels)
|
||||
set(OCL_NAME opencl_kernels_${name})
|
||||
ocv_include_directories(${OPENCL_INCLUDE_DIRS})
|
||||
string(REGEX REPLACE "opencv_" "" the_module_barename "${the_module}")
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp"
|
||||
COMMAND ${CMAKE_COMMAND} -DMODULE_NAME="${the_module_barename}" -DCL_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp"
|
||||
COMMAND ${CMAKE_COMMAND} -DMODULE_NAME="${name}" -DCL_DIR="${CMAKE_CURRENT_LIST_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
|
||||
DEPENDS ${cl_kernels} "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake")
|
||||
ocv_source_group("Src\\opencl\\kernels" FILES ${cl_kernels})
|
||||
ocv_source_group("Src\\opencl\\kernels\\autogenerated" FILES "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp")
|
||||
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.cpp" "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels.hpp")
|
||||
ocv_source_group("Src\\opencl\\kernels\\autogenerated" FILES "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp")
|
||||
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.cpp" "${CMAKE_CURRENT_BINARY_DIR}/${OCL_NAME}.hpp")
|
||||
endif()
|
||||
|
||||
ocv_set_module_sources(${_argn} HEADERS ${lib_hdrs} ${lib_hdrs_detail}
|
||||
@ -537,29 +629,39 @@ endmacro()
|
||||
# creates new target, configures standard dependencies, compilers flags, install rules
|
||||
# Usage:
|
||||
# ocv_create_module(<extra link dependencies>)
|
||||
# ocv_create_module(SKIP_LINK)
|
||||
# ocv_create_module()
|
||||
macro(ocv_create_module)
|
||||
ocv_debug_message("ocv_create_module(" ${ARGN} ")")
|
||||
set(OPENCV_MODULE_${the_module}_LINK_DEPS "${OPENCV_MODULE_${the_module}_LINK_DEPS};${ARGN}" CACHE INTERNAL "")
|
||||
if(${BUILD_opencv_world} AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
|
||||
# nothing
|
||||
set(the_module_target opencv_world)
|
||||
else()
|
||||
_ocv_create_module(${ARGN})
|
||||
set(the_module_target ${the_module})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(_ocv_create_module)
|
||||
# The condition we ought to be testing here is whether ocv_add_precompiled_headers will
|
||||
# be called at some point in the future. We can't look into the future, though,
|
||||
# so this will have to do.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp" AND NOT ${the_module} STREQUAL opencv_world)
|
||||
get_native_precompiled_header(${the_module} precomp.hpp)
|
||||
endif()
|
||||
|
||||
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}
|
||||
ocv_add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}
|
||||
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp"
|
||||
${${the_module}_pch})
|
||||
if(NOT the_module STREQUAL opencv_ts)
|
||||
set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL)
|
||||
endif()
|
||||
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
if (HAVE_CUDA)
|
||||
target_link_libraries(${the_module} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
endif()
|
||||
ocv_target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_TO_LINK})
|
||||
ocv_target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS_TO_LINK})
|
||||
ocv_target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
if (HAVE_CUDA)
|
||||
ocv_target_link_libraries(${the_module} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@ -614,13 +716,16 @@ macro(ocv_create_module)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
_ocv_add_precompiled_headers(${the_module})
|
||||
endmacro()
|
||||
|
||||
# opencv precompiled headers macro (can add pch to modules and tests)
|
||||
# this macro must be called after any "add_definitions" commands, otherwise precompiled headers will not work
|
||||
# Usage:
|
||||
# ocv_add_precompiled_headers(${the_module})
|
||||
macro(ocv_add_precompiled_headers the_target)
|
||||
macro(_ocv_add_precompiled_headers the_target)
|
||||
ocv_debug_message("ocv_add_precompiled_headers(" ${the_target} ${ARGN} ")")
|
||||
|
||||
if("${the_target}" MATCHES "^opencv_test_.*$")
|
||||
SET(pch_path "test/test_")
|
||||
elseif("${the_target}" MATCHES "^opencv_perf_.*$")
|
||||
@ -637,6 +742,7 @@ endmacro()
|
||||
# Usage:
|
||||
# ocv_define_module(module_name [INTERNAL] [EXCLUDE_CUDA] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
macro(ocv_define_module module_name)
|
||||
ocv_debug_message("ocv_define_module(" ${module_name} ${ARGN} ")")
|
||||
set(_argn ${ARGN})
|
||||
set(exclude_cuda "")
|
||||
foreach(arg ${_argn})
|
||||
@ -647,10 +753,9 @@ macro(ocv_define_module module_name)
|
||||
endforeach()
|
||||
|
||||
ocv_add_module(${module_name} ${_argn})
|
||||
ocv_module_include_directories()
|
||||
ocv_glob_module_sources(${exclude_cuda})
|
||||
ocv_module_include_directories()
|
||||
ocv_create_module()
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
@ -685,7 +790,7 @@ macro(__ocv_parse_test_sources tests_type)
|
||||
set(__file_group_name "")
|
||||
set(__file_group_sources "")
|
||||
elseif(arg STREQUAL "DEPENDS_ON")
|
||||
set(__currentvar "OPENCV_TEST_${the_module}_DEPS")
|
||||
set(__currentvar "OPENCV_${tests_type}_${the_module}_DEPS")
|
||||
elseif("${__currentvar}" STREQUAL "__file_group_sources" AND NOT __file_group_name)
|
||||
set(__file_group_name "${arg}")
|
||||
else()
|
||||
@ -700,20 +805,20 @@ endmacro()
|
||||
# this is a command for adding OpenCV performance tests to the module
|
||||
# ocv_add_perf_tests(<extra_dependencies>)
|
||||
function(ocv_add_perf_tests)
|
||||
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf")
|
||||
ocv_debug_message("ocv_add_perf_tests(" ${ARGN} ")")
|
||||
|
||||
set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
|
||||
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
|
||||
__ocv_parse_test_sources(PERF ${ARGN})
|
||||
|
||||
# opencv_imgcodecs is required for imread/imwrite
|
||||
set(perf_deps ${the_module} opencv_ts opencv_imgcodecs ${OPENCV_PERF_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
set(perf_deps ${the_module} opencv_ts opencv_imgcodecs ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
ocv_check_dependencies(${perf_deps})
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
set(the_target "opencv_perf_${name}")
|
||||
# project(${the_target})
|
||||
|
||||
ocv_module_include_directories(${perf_deps} "${perf_path}")
|
||||
|
||||
if(NOT OPENCV_PERF_${the_module}_SOURCES)
|
||||
file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp")
|
||||
file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h")
|
||||
@ -722,10 +827,13 @@ function(ocv_add_perf_tests)
|
||||
set(OPENCV_PERF_${the_module}_SOURCES ${perf_srcs} ${perf_hdrs})
|
||||
endif()
|
||||
|
||||
get_native_precompiled_header(${the_target} perf_precomp.hpp)
|
||||
if(NOT BUILD_opencv_world)
|
||||
get_native_precompiled_header(${the_target} perf_precomp.hpp)
|
||||
endif()
|
||||
|
||||
add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${perf_deps} ${OPENCV_LINKER_LIBS})
|
||||
ocv_add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
ocv_target_include_modules(${the_target} ${perf_deps} "${perf_path}")
|
||||
ocv_target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${perf_deps} ${OPENCV_LINKER_LIBS})
|
||||
add_dependencies(opencv_perf_tests ${the_target})
|
||||
|
||||
# Additional target properties
|
||||
@ -738,8 +846,9 @@ function(ocv_add_perf_tests)
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "tests performance")
|
||||
endif()
|
||||
|
||||
ocv_add_precompiled_headers(${the_target})
|
||||
|
||||
if(NOT BUILD_opencv_world)
|
||||
_ocv_add_precompiled_headers(${the_target})
|
||||
endif()
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
endif(OCV_DEPENDENCIES_FOUND)
|
||||
@ -752,21 +861,19 @@ endfunction()
|
||||
# this is a command for adding OpenCV accuracy/regression tests to the module
|
||||
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>)
|
||||
function(ocv_add_accuracy_tests)
|
||||
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test")
|
||||
ocv_check_dependencies(${test_deps})
|
||||
ocv_debug_message("ocv_add_accuracy_tests(" ${ARGN} ")")
|
||||
|
||||
set(test_path "${CMAKE_CURRENT_LIST_DIR}/test")
|
||||
if(BUILD_TESTS AND EXISTS "${test_path}")
|
||||
__ocv_parse_test_sources(TEST ${ARGN})
|
||||
|
||||
# opencv_imgcodecs is required for imread/imwrite
|
||||
set(test_deps ${the_module} opencv_ts opencv_imgcodecs opencv_videoio ${OPENCV_TEST_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
set(test_deps ${the_module} opencv_ts opencv_imgcodecs opencv_videoio ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
ocv_check_dependencies(${test_deps})
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
set(the_target "opencv_test_${name}")
|
||||
# project(${the_target})
|
||||
|
||||
ocv_module_include_directories(${test_deps} "${test_path}")
|
||||
|
||||
if(NOT OPENCV_TEST_${the_module}_SOURCES)
|
||||
file(GLOB_RECURSE test_srcs "${test_path}/*.cpp")
|
||||
file(GLOB_RECURSE test_hdrs "${test_path}/*.hpp" "${test_path}/*.h")
|
||||
@ -775,10 +882,13 @@ function(ocv_add_accuracy_tests)
|
||||
set(OPENCV_TEST_${the_module}_SOURCES ${test_srcs} ${test_hdrs})
|
||||
endif()
|
||||
|
||||
get_native_precompiled_header(${the_target} test_precomp.hpp)
|
||||
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
if(NOT BUILD_opencv_world)
|
||||
get_native_precompiled_header(${the_target} test_precomp.hpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
|
||||
ocv_add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
ocv_target_include_modules(${the_target} ${test_deps} "${test_path}")
|
||||
ocv_target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
# Additional target properties
|
||||
@ -795,7 +905,9 @@ function(ocv_add_accuracy_tests)
|
||||
get_target_property(LOC ${the_target} LOCATION)
|
||||
add_test(${the_target} "${LOC}")
|
||||
|
||||
ocv_add_precompiled_headers(${the_target})
|
||||
if(NOT BUILD_opencv_world)
|
||||
_ocv_add_precompiled_headers(${the_target})
|
||||
endif()
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
endif(OCV_DEPENDENCIES_FOUND)
|
||||
@ -807,6 +919,8 @@ function(ocv_add_accuracy_tests)
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_samples)
|
||||
ocv_debug_message("ocv_add_samples(" ${ARGN} ")")
|
||||
|
||||
set(samples_path "${CMAKE_CURRENT_SOURCE_DIR}/samples")
|
||||
string(REGEX REPLACE "^opencv_" "" module_id ${the_module})
|
||||
|
||||
@ -816,15 +930,14 @@ function(ocv_add_samples)
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
file(GLOB sample_sources "${samples_path}/*.cpp")
|
||||
ocv_include_modules(${OPENCV_MODULE_${the_module}_DEPS})
|
||||
|
||||
foreach(source ${sample_sources})
|
||||
get_filename_component(name "${source}" NAME_WE)
|
||||
set(the_target "example_${module_id}_${name}")
|
||||
|
||||
add_executable(${the_target} "${source}")
|
||||
target_link_libraries(${the_target} ${samples_deps})
|
||||
|
||||
ocv_add_executable(${the_target} "${source}")
|
||||
ocv_target_include_modules(${the_target} ${samples_deps})
|
||||
ocv_target_link_libraries(${the_target} ${samples_deps})
|
||||
set_target_properties(${the_target} PROPERTIES PROJECT_LABEL "(sample) ${name}")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
@ -847,82 +960,3 @@ function(ocv_add_samples)
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# internal macro; finds all link dependencies of the module
|
||||
# should be used at the end of CMake processing
|
||||
macro(__ocv_track_module_link_dependencies the_module optkind)
|
||||
set(${the_module}_MODULE_DEPS_${optkind} "")
|
||||
set(${the_module}_EXTRA_DEPS_${optkind} "")
|
||||
|
||||
get_target_property(__module_type ${the_module} TYPE)
|
||||
if(__module_type STREQUAL "STATIC_LIBRARY")
|
||||
#in case of static library we have to inherit its dependencies (in right order!!!)
|
||||
if(NOT DEFINED ${the_module}_LIB_DEPENDS_${optkind})
|
||||
ocv_split_libs_list(${the_module}_LIB_DEPENDS ${the_module}_LIB_DEPENDS_DBG ${the_module}_LIB_DEPENDS_OPT)
|
||||
endif()
|
||||
|
||||
set(__resolved_deps "")
|
||||
set(__mod_depends ${${the_module}_LIB_DEPENDS_${optkind}})
|
||||
set(__has_cycle FALSE)
|
||||
|
||||
while(__mod_depends)
|
||||
list(GET __mod_depends 0 __dep)
|
||||
list(REMOVE_AT __mod_depends 0)
|
||||
if(__dep STREQUAL the_module)
|
||||
set(__has_cycle TRUE)
|
||||
else()#if("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
|
||||
ocv_regex_escape(__rdep "${__dep}")
|
||||
if(__resolved_deps MATCHES "(^|;)${__rdep}(;|$)")
|
||||
#all dependencies of this module are already resolved
|
||||
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${__dep}")
|
||||
else()
|
||||
get_target_property(__module_type ${__dep} TYPE)
|
||||
if(__module_type STREQUAL "STATIC_LIBRARY")
|
||||
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind})
|
||||
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT)
|
||||
endif()
|
||||
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep})
|
||||
list(APPEND __resolved_deps "${__dep}")
|
||||
elseif(NOT __module_type)
|
||||
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}")
|
||||
endif()
|
||||
endif()
|
||||
#else()
|
||||
# get_target_property(__dep_location "${__dep}" LOCATION)
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
ocv_list_unique(${the_module}_MODULE_DEPS_${optkind})
|
||||
#ocv_list_reverse(${the_module}_MODULE_DEPS_${optkind})
|
||||
ocv_list_unique(${the_module}_EXTRA_DEPS_${optkind})
|
||||
#ocv_list_reverse(${the_module}_EXTRA_DEPS_${optkind})
|
||||
|
||||
if(__has_cycle)
|
||||
# not sure if it can work
|
||||
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}")
|
||||
endif()
|
||||
|
||||
unset(__dep_location)
|
||||
unset(__mod_depends)
|
||||
unset(__resolved_deps)
|
||||
unset(__has_cycle)
|
||||
unset(__rdep)
|
||||
endif()#STATIC_LIBRARY
|
||||
unset(__module_type)
|
||||
|
||||
#message("${the_module}_MODULE_DEPS_${optkind}")
|
||||
#message(" ${${the_module}_MODULE_DEPS_${optkind}}")
|
||||
#message(" ${OPENCV_MODULE_${the_module}_DEPS}")
|
||||
#message("")
|
||||
#message("${the_module}_EXTRA_DEPS_${optkind}")
|
||||
#message(" ${${the_module}_EXTRA_DEPS_${optkind}}")
|
||||
#message("")
|
||||
endmacro()
|
||||
|
||||
# creates lists of build dependencies needed for external projects
|
||||
macro(ocv_track_build_dependencies)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
__ocv_track_module_link_dependencies("${m}" OPT)
|
||||
__ocv_track_module_link_dependencies("${m}" DBG)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
@ -68,6 +68,15 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
get_target_property(DIRINC ${_PCH_current_target} INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${OpenCV_SOURCE_DIR} DEFINITIONS)
|
||||
#MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" )
|
||||
@ -254,6 +263,9 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(DIRINC ${_targetName} INCLUDE_DIRECTORIES)
|
||||
set_target_properties(${_targetName}_pch_dephelp PROPERTIES INCLUDE_DIRECTORIES "${DIRINC}")
|
||||
|
||||
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
|
||||
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
|
||||
|
||||
|
@ -42,6 +42,11 @@ macro(ocv_assert)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_debug_message)
|
||||
# string(REPLACE ";" " " __msg "${ARGN}")
|
||||
# message(STATUS "${__msg}")
|
||||
endmacro()
|
||||
|
||||
macro(ocv_check_environment_variables)
|
||||
foreach(_var ${ARGN})
|
||||
if(NOT DEFINED ${_var} AND DEFINED ENV{${_var}})
|
||||
@ -53,8 +58,18 @@ macro(ocv_check_environment_variables)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# rename modules target to world if needed
|
||||
macro(_ocv_fix_target target_var)
|
||||
if(BUILD_opencv_world)
|
||||
if(OPENCV_MODULE_${${target_var}}_IS_PART_OF_WORLD)
|
||||
set(${target_var} opencv_world)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
ocv_debug_message("ocv_include_directories( ${ARGN} )")
|
||||
set(__add_before "")
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
@ -67,6 +82,30 @@ function(ocv_include_directories)
|
||||
include_directories(BEFORE ${__add_before})
|
||||
endfunction()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_target_include_directories target)
|
||||
_ocv_fix_target(target)
|
||||
set(__params "")
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
|
||||
list(APPEND __params "${__abs_dir}")
|
||||
else()
|
||||
list(APPEND __params "${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
include_directories(${__params})
|
||||
else()
|
||||
if(TARGET ${target})
|
||||
target_include_directories(${target} PRIVATE ${__params})
|
||||
else()
|
||||
set(__new_inc "${OCV_TARGET_INCLUDE_DIRS_${target}};${__params}")
|
||||
set(OCV_TARGET_INCLUDE_DIRS_${target} "${__new_inc}" CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# clears all passed variables
|
||||
macro(ocv_clear_vars)
|
||||
foreach(_var ${ARGN})
|
||||
@ -295,8 +334,8 @@ endfunction()
|
||||
|
||||
macro(ocv_finalize_status)
|
||||
if(NOT OPENCV_SKIP_STATUS_FINALIZATION)
|
||||
if(TARGET opencv_core)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENCV_BUILD_INFO_FILE}" "${opencv_core_BINARY_DIR}/version_string.inc" OUTPUT_QUIET)
|
||||
if(DEFINED OPENCV_MODULE_opencv_core_BINARY_DIR)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENCV_BUILD_INFO_FILE}" "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string.inc" OUTPUT_QUIET)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@ -533,16 +572,20 @@ function(ocv_install_target)
|
||||
|
||||
# message(STATUS "Process ${__target} dst=${__dst}...")
|
||||
if(DEFINED __dst)
|
||||
get_target_property(fname ${__target} LOCATION_DEBUG)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
get_target_property(fname ${__target} LOCATION_DEBUG)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
|
||||
endif()
|
||||
|
||||
get_target_property(fname ${__target} LOCATION_RELEASE)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
|
||||
get_target_property(fname ${__target} LOCATION_RELEASE)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
|
||||
endif()
|
||||
else()
|
||||
# CMake 2.8.12 brokes PDB support in STATIC libraries for MSVS
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -637,6 +680,9 @@ endmacro()
|
||||
################################################################################################
|
||||
# short command to setup source group
|
||||
function(ocv_source_group group)
|
||||
if(BUILD_opencv_world AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
|
||||
set(group "${the_module}\\${group}")
|
||||
endif()
|
||||
cmake_parse_arguments(SG "" "DIRBASE" "GLOB;GLOB_RECURSE;FILES" ${ARGN})
|
||||
set(files "")
|
||||
if(SG_FILES)
|
||||
@ -669,3 +715,39 @@ function(ocv_source_group group)
|
||||
source_group(${group} FILES ${files})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_target_link_libraries target)
|
||||
_ocv_fix_target(target)
|
||||
set(LINK_DEPS ${ARGN})
|
||||
# process world
|
||||
if(BUILD_opencv_world)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
|
||||
if(";${LINK_DEPS};" MATCHES ";${m};")
|
||||
list(REMOVE_ITEM LINK_DEPS ${m})
|
||||
if(NOT (";${LINK_DEPS};" MATCHES ";opencv_world;"))
|
||||
list(APPEND LINK_DEPS opencv_world)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
target_link_libraries(${target} ${LINK_DEPS})
|
||||
endfunction()
|
||||
|
||||
function(_ocv_append_target_includes target)
|
||||
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
|
||||
target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
|
||||
unset(OCV_TARGET_INCLUDE_DIRS_${target} CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_executable target)
|
||||
add_executable(${target} ${ARGN})
|
||||
_ocv_append_target_includes(${target})
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_library target)
|
||||
add_library(${target} ${ARGN})
|
||||
_ocv_append_target_includes(${target})
|
||||
endfunction()
|
@ -141,6 +141,7 @@ SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@")
|
||||
# ====================================================================
|
||||
|
||||
SET(OpenCV_LIB_COMPONENTS @OPENCV_MODULES_CONFIGCMAKE@)
|
||||
SET(OpenCV_WORLD_COMPONENTS @OPENCV_WORLD_MODULES@)
|
||||
|
||||
# ==============================================================
|
||||
# Extra include directories, needed by OpenCV 2 new structure
|
||||
@ -200,8 +201,8 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
||||
message(WARNING "${__cvcomponent} is required but was not found")
|
||||
endif()
|
||||
#indicate that module is NOT found
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
||||
set(${__cvcomponent}_FOUND "${__cvcomponent}_FOUND-NOTFOUND")
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponentUP)
|
||||
set(${__cvcomponentUP}_FOUND "${__cvcomponentUP}_FOUND-NOTFOUND")
|
||||
else()
|
||||
list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent})
|
||||
# Not using list(APPEND) here, because OpenCV_LIBS may not exist yet.
|
||||
@ -209,8 +210,31 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
||||
# to find_package(OpenCV) with different component lists add up.
|
||||
set(OpenCV_LIBS ${OpenCV_LIBS} "${__cvcomponent}")
|
||||
#indicate that module is found
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
||||
set(${__cvcomponent}_FOUND 1)
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponentUP)
|
||||
set(${__cvcomponentUP}_FOUND 1)
|
||||
endif()
|
||||
if(OpenCV_SHARED AND ";${OpenCV_WORLD_COMPONENTS};" MATCHES ";${__cvcomponent};" AND NOT TARGET ${__cvcomponent})
|
||||
get_target_property(__implib_dbg opencv_world IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(__implib_release opencv_world IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(__location_dbg opencv_world IMPORTED_LOCATION_DEBUG)
|
||||
get_target_property(__location_release opencv_world IMPORTED_LOCATION_RELEASE)
|
||||
add_library(${__cvcomponent} SHARED IMPORTED)
|
||||
if(__location_dbg)
|
||||
set_property(TARGET ${__cvcomponent} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(${__cvcomponent} PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${__implib_dbg}"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG ""
|
||||
IMPORTED_LOCATION_DEBUG "${__location_dbg}"
|
||||
)
|
||||
endif()
|
||||
if(__location_release)
|
||||
set_property(TARGET ${__cvcomponent} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(${__cvcomponent} PROPERTIES
|
||||
IMPORTED_IMPLIB_RELEASE "${__implib_release}"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE ""
|
||||
IMPORTED_LOCATION_RELEASE "${__location_release}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
|
||||
@ -321,6 +345,7 @@ macro(ocv_check_dependencies)
|
||||
set(OCV_DEPENDENCIES_FOUND TRUE)
|
||||
foreach(d ${ARGN})
|
||||
if(NOT TARGET ${d})
|
||||
message(WARNING "OpenCV: Can't resolve dependency: ${d}")
|
||||
set(OCV_DEPENDENCIES_FOUND FALSE)
|
||||
break()
|
||||
endif()
|
||||
@ -346,6 +371,10 @@ macro(ocv_include_modules)
|
||||
include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
|
||||
endmacro()
|
||||
|
||||
macro(ocv_target_link_libraries)
|
||||
target_link_libraries(${ARGN})
|
||||
endmacro()
|
||||
|
||||
# remove all matching elements from the list
|
||||
macro(ocv_list_filterout lst regex)
|
||||
foreach(item ${${lst}})
|
||||
|
@ -4,4 +4,4 @@ if(NOT OPENCV_MODULES_PATH)
|
||||
set(OPENCV_MODULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
|
||||
ocv_glob_modules(${OPENCV_MODULES_PATH} EXTRA ${OPENCV_EXTRA_MODULES_PATH})
|
||||
|
@ -46,7 +46,7 @@ ADD_LIBRARY(${the_target} SHARED camera_wrapper.h camera_wrapper.cpp)
|
||||
string(REGEX REPLACE "[.]" "_" LIBRARY_DEF ${ANDROID_VERSION})
|
||||
add_definitions(-DANDROID_r${LIBRARY_DEF})
|
||||
|
||||
target_link_libraries(${the_target} c m dl utils camera_client binder log)
|
||||
ocv_target_link_libraries(${the_target} c m dl utils camera_client binder log)
|
||||
|
||||
if(NOT ANDROID_VERSION VERSION_LESS "3.0.0")
|
||||
target_link_libraries(${the_target} gui )
|
||||
|
@ -40,7 +40,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -40,6 +40,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "circlesgrid.hpp"
|
||||
#include <limits>
|
||||
//#define DEBUG_CIRCLES
|
||||
|
@ -139,11 +139,13 @@ namespace cv
|
||||
CameraParameters camera;
|
||||
};
|
||||
|
||||
template <typename OpointType, typename IpointType>
|
||||
static void pnpTask(const std::vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints,
|
||||
const Parameters& params, std::vector<int>& inliers, Mat& rvec, Mat& tvec,
|
||||
const Mat& rvecInit, const Mat& tvecInit, Mutex& resultsMutex)
|
||||
{
|
||||
Mat modelObjectPoints(1, MIN_POINTS_COUNT, CV_32FC3), modelImagePoints(1, MIN_POINTS_COUNT, CV_32FC2);
|
||||
Mat modelObjectPoints(1, MIN_POINTS_COUNT, CV_MAKETYPE(DataDepth<OpointType>::value, 3));
|
||||
Mat modelImagePoints(1, MIN_POINTS_COUNT, CV_MAKETYPE(DataDepth<IpointType>::value, 2));
|
||||
for (int i = 0, colIndex = 0; i < (int)pointsMask.size(); i++)
|
||||
{
|
||||
if (pointsMask[i])
|
||||
@ -162,7 +164,7 @@ namespace cv
|
||||
for (int i = 0; i < MIN_POINTS_COUNT; i++)
|
||||
for (int j = i + 1; j < MIN_POINTS_COUNT; j++)
|
||||
{
|
||||
if (norm(modelObjectPoints.at<Vec3f>(0, i) - modelObjectPoints.at<Vec3f>(0, j)) < eps)
|
||||
if (norm(modelObjectPoints.at<Vec<OpointType,3> >(0, i) - modelObjectPoints.at<Vec<OpointType,3> >(0, j)) < eps)
|
||||
num_same_points++;
|
||||
}
|
||||
if (num_same_points > 0)
|
||||
@ -176,7 +178,7 @@ namespace cv
|
||||
params.useExtrinsicGuess, params.flags);
|
||||
|
||||
|
||||
std::vector<Point2f> projected_points;
|
||||
std::vector<Point_<OpointType> > projected_points;
|
||||
projected_points.resize(objectPoints.cols);
|
||||
projectPoints(objectPoints, localRvec, localTvec, params.camera.intrinsics, params.camera.distortion, projected_points);
|
||||
|
||||
@ -186,9 +188,11 @@ namespace cv
|
||||
std::vector<int> localInliers;
|
||||
for (int i = 0; i < objectPoints.cols; i++)
|
||||
{
|
||||
Point2f p(imagePoints.at<Vec2f>(0, i)[0], imagePoints.at<Vec2f>(0, i)[1]);
|
||||
//Although p is a 2D point it needs the same type as the object points to enable the norm calculation
|
||||
Point_<OpointType> p((OpointType)imagePoints.at<Vec<IpointType,2> >(0, i)[0],
|
||||
(OpointType)imagePoints.at<Vec<IpointType,2> >(0, i)[1]);
|
||||
if ((norm(p - projected_points[i]) < params.reprojectionError)
|
||||
&& (rotatedPoints.at<Vec3f>(0, i)[2] > 0)) //hack
|
||||
&& (rotatedPoints.at<Vec<OpointType,3> >(0, i)[2] > 0)) //hack
|
||||
{
|
||||
localInliers.push_back(i);
|
||||
}
|
||||
@ -208,6 +212,30 @@ namespace cv
|
||||
}
|
||||
}
|
||||
|
||||
static void pnpTask(const std::vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints,
|
||||
const Parameters& params, std::vector<int>& inliers, Mat& rvec, Mat& tvec,
|
||||
const Mat& rvecInit, const Mat& tvecInit, Mutex& resultsMutex)
|
||||
{
|
||||
CV_Assert(objectPoints.depth() == CV_64F || objectPoints.depth() == CV_32F);
|
||||
CV_Assert(imagePoints.depth() == CV_64F || imagePoints.depth() == CV_32F);
|
||||
const bool objectDoublePrecision = objectPoints.depth() == CV_64F;
|
||||
const bool imageDoublePrecision = imagePoints.depth() == CV_64F;
|
||||
if(objectDoublePrecision)
|
||||
{
|
||||
if(imageDoublePrecision)
|
||||
pnpTask<double, double>(pointsMask, objectPoints, imagePoints, params, inliers, rvec, tvec, rvecInit, tvecInit, resultsMutex);
|
||||
else
|
||||
pnpTask<double, float>(pointsMask, objectPoints, imagePoints, params, inliers, rvec, tvec, rvecInit, tvecInit, resultsMutex);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(imageDoublePrecision)
|
||||
pnpTask<float, double>(pointsMask, objectPoints, imagePoints, params, inliers, rvec, tvec, rvecInit, tvecInit, resultsMutex);
|
||||
else
|
||||
pnpTask<float, float>(pointsMask, objectPoints, imagePoints, params, inliers, rvec, tvec, rvecInit, tvecInit, resultsMutex);
|
||||
}
|
||||
}
|
||||
|
||||
class PnPSolver
|
||||
{
|
||||
public:
|
||||
@ -283,10 +311,10 @@ void cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
|
||||
Mat cameraMatrix = _cameraMatrix.getMat(), distCoeffs = _distCoeffs.getMat();
|
||||
|
||||
CV_Assert(opoints.isContinuous());
|
||||
CV_Assert(opoints.depth() == CV_32F);
|
||||
CV_Assert(opoints.depth() == CV_32F || opoints.depth() == CV_64F);
|
||||
CV_Assert((opoints.rows == 1 && opoints.channels() == 3) || opoints.cols*opoints.channels() == 3);
|
||||
CV_Assert(ipoints.isContinuous());
|
||||
CV_Assert(ipoints.depth() == CV_32F);
|
||||
CV_Assert(ipoints.depth() == CV_32F || ipoints.depth() == CV_64F);
|
||||
CV_Assert((ipoints.rows == 1 && ipoints.channels() == 2) || ipoints.cols*ipoints.channels() == 2);
|
||||
|
||||
_rvec.create(3, 1, CV_64FC1);
|
||||
@ -322,7 +350,7 @@ void cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
|
||||
if (flags != P3P)
|
||||
{
|
||||
int i, pointsCount = (int)localInliers.size();
|
||||
Mat inlierObjectPoints(1, pointsCount, CV_32FC3), inlierImagePoints(1, pointsCount, CV_32FC2);
|
||||
Mat inlierObjectPoints(1, pointsCount, CV_MAKE_TYPE(opoints.depth(), 3)), inlierImagePoints(1, pointsCount, CV_MAKE_TYPE(ipoints.depth(), 2));
|
||||
for (i = 0; i < pointsCount; i++)
|
||||
{
|
||||
int index = localInliers[i];
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include <stdio.h>
|
||||
#include <limits>
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_calib3d.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
set(the_description "The Core Functionality")
|
||||
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev)
|
||||
ocv_module_include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
if(HAVE_WINRT_CX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
|
||||
@ -19,11 +18,11 @@ file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "incl
|
||||
source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
|
||||
source_group("Cuda Headers\\Detail" FILES ${lib_cuda_hdrs_detail})
|
||||
|
||||
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc"
|
||||
ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string.inc"
|
||||
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
|
||||
|
||||
ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
|
||||
ocv_create_module()
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -4,7 +4,7 @@
|
||||
//
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -4,7 +4,7 @@
|
||||
//
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -47,7 +47,7 @@
|
||||
// */
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@ -50,6 +50,71 @@ namespace cv
|
||||
* split & merge *
|
||||
\****************************************************************************************/
|
||||
|
||||
#if CV_NEON
|
||||
template<typename T> struct VSplit2;
|
||||
template<typename T> struct VSplit3;
|
||||
template<typename T> struct VSplit4;
|
||||
|
||||
#define SPLIT2_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src, data_type* dst0, data_type* dst1){ \
|
||||
reg_type r = load_func(src); \
|
||||
store_func(dst0, r.val[0]); \
|
||||
store_func(dst1, r.val[1]); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SPLIT3_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src, data_type* dst0, data_type* dst1, \
|
||||
data_type* dst2){ \
|
||||
reg_type r = load_func(src); \
|
||||
store_func(dst0, r.val[0]); \
|
||||
store_func(dst1, r.val[1]); \
|
||||
store_func(dst2, r.val[2]); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SPLIT4_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src, data_type* dst0, data_type* dst1, \
|
||||
data_type* dst2, data_type* dst3){ \
|
||||
reg_type r = load_func(src); \
|
||||
store_func(dst0, r.val[0]); \
|
||||
store_func(dst1, r.val[1]); \
|
||||
store_func(dst2, r.val[2]); \
|
||||
store_func(dst3, r.val[3]); \
|
||||
} \
|
||||
}
|
||||
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, uchar , uint8x16x2_t, vld2q_u8 , vst1q_u8 );
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, schar , int8x16x2_t, vld2q_s8 , vst1q_s8 );
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, ushort, uint16x8x2_t, vld2q_u16, vst1q_u16);
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, short , int16x8x2_t, vld2q_s16, vst1q_s16);
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, int , int32x4x2_t, vld2q_s32, vst1q_s32);
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, float , float32x4x2_t, vld2q_f32, vst1q_f32);
|
||||
SPLIT2_KERNEL_TEMPLATE(VSplit2, int64 , int64x1x2_t, vld2_s64 , vst1_s64 );
|
||||
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, uchar , uint8x16x3_t, vld3q_u8 , vst1q_u8 );
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, schar , int8x16x3_t, vld3q_s8 , vst1q_s8 );
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, ushort, uint16x8x3_t, vld3q_u16, vst1q_u16);
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, short , int16x8x3_t, vld3q_s16, vst1q_s16);
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, int , int32x4x3_t, vld3q_s32, vst1q_s32);
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, float , float32x4x3_t, vld3q_f32, vst1q_f32);
|
||||
SPLIT3_KERNEL_TEMPLATE(VSplit3, int64 , int64x1x3_t, vld3_s64 , vst1_s64 );
|
||||
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, uchar , uint8x16x4_t, vld4q_u8 , vst1q_u8 );
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, schar , int8x16x4_t, vld4q_s8 , vst1q_s8 );
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, ushort, uint16x8x4_t, vld4q_u16, vst1q_u16);
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, short , int16x8x4_t, vld4q_s16, vst1q_s16);
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, int , int32x4x4_t, vld4q_s32, vst1q_s32);
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, float , float32x4x4_t, vld4q_f32, vst1q_f32);
|
||||
SPLIT4_KERNEL_TEMPLATE(VSplit4, int64 , int64x1x4_t, vld4_s64 , vst1_s64 );
|
||||
#endif
|
||||
|
||||
template<typename T> static void
|
||||
split_( const T* src, T** dst, int len, int cn )
|
||||
{
|
||||
@ -58,13 +123,34 @@ split_( const T* src, T** dst, int len, int cn )
|
||||
if( k == 1 )
|
||||
{
|
||||
T* dst0 = dst[0];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
dst0[i] = src[j];
|
||||
|
||||
if(cn == 1)
|
||||
{
|
||||
memcpy(dst0, src, len * sizeof(T));
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0, j = 0 ; i < len; i++, j += cn )
|
||||
dst0[i] = src[j];
|
||||
}
|
||||
}
|
||||
else if( k == 2 )
|
||||
{
|
||||
T *dst0 = dst[0], *dst1 = dst[1];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
|
||||
#if CV_NEON
|
||||
if(cn == 2)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 2 * inc_i;
|
||||
|
||||
VSplit2<T> vsplit;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vsplit(src + j, dst0 + i, dst1 + i);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst0[i] = src[j];
|
||||
dst1[i] = src[j+1];
|
||||
@ -73,7 +159,20 @@ split_( const T* src, T** dst, int len, int cn )
|
||||
else if( k == 3 )
|
||||
{
|
||||
T *dst0 = dst[0], *dst1 = dst[1], *dst2 = dst[2];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
|
||||
#if CV_NEON
|
||||
if(cn == 3)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 3 * inc_i;
|
||||
|
||||
VSplit3<T> vsplit;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vsplit(src + j, dst0 + i, dst1 + i, dst2 + i);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst0[i] = src[j];
|
||||
dst1[i] = src[j+1];
|
||||
@ -83,7 +182,20 @@ split_( const T* src, T** dst, int len, int cn )
|
||||
else
|
||||
{
|
||||
T *dst0 = dst[0], *dst1 = dst[1], *dst2 = dst[2], *dst3 = dst[3];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
|
||||
#if CV_NEON
|
||||
if(cn == 4)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 4 * inc_i;
|
||||
|
||||
VSplit4<T> vsplit;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vsplit(src + j, dst0 + i, dst1 + i, dst2 + i, dst3 + i);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst0[i] = src[j]; dst1[i] = src[j+1];
|
||||
dst2[i] = src[j+2]; dst3[i] = src[j+3];
|
||||
@ -101,6 +213,77 @@ split_( const T* src, T** dst, int len, int cn )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if CV_NEON
|
||||
template<typename T> struct VMerge2;
|
||||
template<typename T> struct VMerge3;
|
||||
template<typename T> struct VMerge4;
|
||||
|
||||
#define MERGE2_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src0, const data_type* src1, \
|
||||
data_type* dst){ \
|
||||
reg_type r; \
|
||||
r.val[0] = load_func(src0); \
|
||||
r.val[1] = load_func(src1); \
|
||||
store_func(dst, r); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MERGE3_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src0, const data_type* src1, \
|
||||
const data_type* src2, data_type* dst){ \
|
||||
reg_type r; \
|
||||
r.val[0] = load_func(src0); \
|
||||
r.val[1] = load_func(src1); \
|
||||
r.val[2] = load_func(src2); \
|
||||
store_func(dst, r); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MERGE4_KERNEL_TEMPLATE(name, data_type, reg_type, load_func, store_func) \
|
||||
template<> \
|
||||
struct name<data_type>{ \
|
||||
void operator()(const data_type* src0, const data_type* src1, \
|
||||
const data_type* src2, const data_type* src3, \
|
||||
data_type* dst){ \
|
||||
reg_type r; \
|
||||
r.val[0] = load_func(src0); \
|
||||
r.val[1] = load_func(src1); \
|
||||
r.val[2] = load_func(src2); \
|
||||
r.val[3] = load_func(src3); \
|
||||
store_func(dst, r); \
|
||||
} \
|
||||
}
|
||||
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, uchar , uint8x16x2_t, vld1q_u8 , vst2q_u8 );
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, schar , int8x16x2_t, vld1q_s8 , vst2q_s8 );
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, ushort, uint16x8x2_t, vld1q_u16, vst2q_u16);
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, short , int16x8x2_t, vld1q_s16, vst2q_s16);
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, int , int32x4x2_t, vld1q_s32, vst2q_s32);
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, float , float32x4x2_t, vld1q_f32, vst2q_f32);
|
||||
MERGE2_KERNEL_TEMPLATE(VMerge2, int64 , int64x1x2_t, vld1_s64 , vst2_s64 );
|
||||
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, uchar , uint8x16x3_t, vld1q_u8 , vst3q_u8 );
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, schar , int8x16x3_t, vld1q_s8 , vst3q_s8 );
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, ushort, uint16x8x3_t, vld1q_u16, vst3q_u16);
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, short , int16x8x3_t, vld1q_s16, vst3q_s16);
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, int , int32x4x3_t, vld1q_s32, vst3q_s32);
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, float , float32x4x3_t, vld1q_f32, vst3q_f32);
|
||||
MERGE3_KERNEL_TEMPLATE(VMerge3, int64 , int64x1x3_t, vld1_s64 , vst3_s64 );
|
||||
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, uchar , uint8x16x4_t, vld1q_u8 , vst4q_u8 );
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, schar , int8x16x4_t, vld1q_s8 , vst4q_s8 );
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, ushort, uint16x8x4_t, vld1q_u16, vst4q_u16);
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, short , int16x8x4_t, vld1q_s16, vst4q_s16);
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, int , int32x4x4_t, vld1q_s32, vst4q_s32);
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, float , float32x4x4_t, vld1q_f32, vst4q_f32);
|
||||
MERGE4_KERNEL_TEMPLATE(VMerge4, int64 , int64x1x4_t, vld1_s64 , vst4_s64 );
|
||||
#endif
|
||||
|
||||
template<typename T> static void
|
||||
merge_( const T** src, T* dst, int len, int cn )
|
||||
{
|
||||
@ -115,7 +298,19 @@ merge_( const T** src, T* dst, int len, int cn )
|
||||
else if( k == 2 )
|
||||
{
|
||||
const T *src0 = src[0], *src1 = src[1];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
#if CV_NEON
|
||||
if(cn == 2)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 2 * inc_i;
|
||||
|
||||
VMerge2<T> vmerge;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vmerge(src0 + i, src1 + i, dst + j);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst[j] = src0[i];
|
||||
dst[j+1] = src1[i];
|
||||
@ -124,7 +319,19 @@ merge_( const T** src, T* dst, int len, int cn )
|
||||
else if( k == 3 )
|
||||
{
|
||||
const T *src0 = src[0], *src1 = src[1], *src2 = src[2];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
#if CV_NEON
|
||||
if(cn == 3)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 3 * inc_i;
|
||||
|
||||
VMerge3<T> vmerge;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vmerge(src0 + i, src1 + i, src2 + i, dst + j);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst[j] = src0[i];
|
||||
dst[j+1] = src1[i];
|
||||
@ -134,7 +341,19 @@ merge_( const T** src, T* dst, int len, int cn )
|
||||
else
|
||||
{
|
||||
const T *src0 = src[0], *src1 = src[1], *src2 = src[2], *src3 = src[3];
|
||||
for( i = j = 0; i < len; i++, j += cn )
|
||||
i = j = 0;
|
||||
#if CV_NEON
|
||||
if(cn == 4)
|
||||
{
|
||||
int inc_i = (sizeof(T) == 8)? 1: 16/sizeof(T);
|
||||
int inc_j = 4 * inc_i;
|
||||
|
||||
VMerge4<T> vmerge;
|
||||
for( ; i < len - inc_i; i += inc_i, j += inc_j)
|
||||
vmerge(src0 + i, src1 + i, src2 + i, src3 + i, dst + j);
|
||||
}
|
||||
#endif
|
||||
for( ; i < len; i++, j += cn )
|
||||
{
|
||||
dst[j] = src0[i]; dst[j+1] = src1[i];
|
||||
dst[j+2] = src2[i]; dst[j+3] = src3[i];
|
||||
|
@ -46,7 +46,7 @@
|
||||
// */
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/opencl/runtime/opencl_clamdfft.hpp"
|
||||
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include <map>
|
||||
|
||||
namespace cv
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp"
|
||||
|
||||
namespace cv
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
#include "bufferpool.impl.hpp"
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "../../precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CLAMDBLAS
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "../../precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CLAMDFFT
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "../../precomp.hpp"
|
||||
|
||||
#if defined(HAVE_OPENCL) && !defined(HAVE_OPENCL_STATIC)
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
|
||||
///////////////////////////////// UMat implementation ///////////////////////////////
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -42,7 +42,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -23,7 +23,5 @@ endif()
|
||||
|
||||
ocv_create_module(${extra_libs})
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests(DEPENDS_ON opencv_imgproc)
|
||||
ocv_add_perf_tests(DEPENDS_ON opencv_imgproc)
|
||||
|
@ -23,7 +23,5 @@ endif()
|
||||
|
||||
ocv_create_module(${extra_libs})
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -29,7 +29,7 @@ if(OCV_DEPENDENCIES_FOUND)
|
||||
endforeach()
|
||||
|
||||
CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module}_SOURCES})
|
||||
target_link_libraries(${the_target} ${test_deps} ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES})
|
||||
ocv_target_link_libraries(${the_target} ${test_deps} ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
# Additional target properties
|
||||
|
@ -43,7 +43,7 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -43,7 +43,7 @@ The references are:
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "fast_score.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_features2d.hpp"
|
||||
|
||||
#if defined _MSC_VER
|
||||
# pragma warning( disable : 4127)
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
/* ************************************************************************* */
|
||||
// OpenCV
|
||||
#include "precomp.hpp"
|
||||
#include "../precomp.hpp"
|
||||
#include <opencv2/features2d.hpp>
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Includes
|
||||
#include "precomp.hpp"
|
||||
#include "../precomp.hpp"
|
||||
#include "AKAZEConfig.h"
|
||||
#include "TEvolution.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define __OPENCV_FEATURES_2D_AKAZE_CONFIG_H__
|
||||
|
||||
// OpenCV Includes
|
||||
#include "precomp.hpp"
|
||||
#include "../precomp.hpp"
|
||||
#include <opencv2/features2d.hpp>
|
||||
|
||||
//*************************************************************************************
|
||||
|
@ -28,7 +28,7 @@
|
||||
* DAGM, 2010
|
||||
*
|
||||
*/
|
||||
#include "precomp.hpp"
|
||||
#include "../precomp.hpp"
|
||||
#include "fed.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Includes
|
||||
#include "precomp.hpp"
|
||||
#include "../precomp.hpp"
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Declaration of functions
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <limits>
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_features2d.hpp"
|
||||
|
||||
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 2
|
||||
#include <Eigen/Array>
|
||||
|
@ -35,7 +35,7 @@
|
||||
/** Authors: Ethan Rublee, Vincent Rabaud, Gary Bradski */
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_features2d.hpp"
|
||||
#include <iterator>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -48,7 +48,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -17,21 +17,27 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
set(highgui_hdrs
|
||||
src/precomp.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
|
||||
)
|
||||
|
||||
set(highgui_srcs
|
||||
src/window.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window.cpp
|
||||
)
|
||||
|
||||
file(GLOB highgui_ext_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB highgui_ext_hdrs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h")
|
||||
|
||||
if(HAVE_QT5)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
QT5_ADD_RESOURCES(_RCC_OUTFILES src/window_QT.qrc)
|
||||
list(APPEND highgui_srcs src/window_QT.cpp src/window_QT.h ${_RCC_OUTFILES})
|
||||
QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||
list(APPEND highgui_srcs
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
|
||||
${_RCC_OUTFILES})
|
||||
|
||||
foreach(dt5_dep Core Gui Widgets Test Concurrent)
|
||||
add_definitions(${Qt5${dt5_dep}_DEFINITIONS})
|
||||
@ -51,24 +57,24 @@ elseif(HAVE_QT)
|
||||
endif()
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
QT4_ADD_RESOURCES(_RCC_OUTFILES src/window_QT.qrc)
|
||||
QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)
|
||||
QT4_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||
QT4_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||
|
||||
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES})
|
||||
list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
|
||||
ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag)
|
||||
if(${_have_flag})
|
||||
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
|
||||
endif()
|
||||
elseif(HAVE_WIN32UI)
|
||||
list(APPEND highgui_srcs src/window_w32.cpp)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_w32.cpp)
|
||||
elseif(HAVE_GTK OR HAVE_GTK3)
|
||||
list(APPEND highgui_srcs src/window_gtk.cpp)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_gtk.cpp)
|
||||
elseif(HAVE_CARBON)
|
||||
list(APPEND highgui_srcs src/window_carbon.cpp)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_carbon.cpp)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Carbon" "-framework QuickTime")
|
||||
elseif(HAVE_COCOA)
|
||||
list(APPEND highgui_srcs src/window_cocoa.mm)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_cocoa.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
@ -90,6 +96,7 @@ ocv_module_include_directories()
|
||||
|
||||
ocv_create_module(${HIGHGUI_LIBRARIES})
|
||||
|
||||
macro(ocv_highgui_configure_target)
|
||||
if(APPLE)
|
||||
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
|
||||
if(HAVE_OBJC_EXCEPTIONS)
|
||||
@ -116,11 +123,17 @@ if(MSVC)
|
||||
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
|
||||
endif()
|
||||
|
||||
#stop automatic dependencies propagation for this module
|
||||
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
if(NOT BUILD_opencv_world)
|
||||
#stop automatic dependencies propagation for this module
|
||||
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
|
||||
endmacro()
|
||||
|
||||
if(NOT BUILD_opencv_world)
|
||||
ocv_highgui_configure_target()
|
||||
endif()
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -50,30 +50,34 @@ if(HAVE_OPENEXR)
|
||||
list(APPEND GRFMT_LIBS ${OPENEXR_LIBRARIES})
|
||||
endif()
|
||||
|
||||
file(GLOB grfmt_hdrs src/grfmt*.hpp)
|
||||
file(GLOB grfmt_srcs src/grfmt*.cpp)
|
||||
list(APPEND grfmt_hdrs src/bitstrm.hpp)
|
||||
list(APPEND grfmt_srcs src/bitstrm.cpp)
|
||||
list(APPEND grfmt_hdrs src/rgbe.hpp)
|
||||
list(APPEND grfmt_srcs src/rgbe.cpp)
|
||||
file(GLOB grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/grfmt*.hpp)
|
||||
file(GLOB grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/grfmt*.cpp)
|
||||
list(APPEND grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/bitstrm.hpp)
|
||||
list(APPEND grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/bitstrm.cpp)
|
||||
list(APPEND grfmt_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/rgbe.hpp)
|
||||
list(APPEND grfmt_srcs ${CMAKE_CURRENT_LIST_DIR}/src/rgbe.cpp)
|
||||
|
||||
source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
|
||||
|
||||
set(imgcodecs_hdrs
|
||||
src/precomp.hpp
|
||||
src/utils.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/utils.hpp
|
||||
)
|
||||
|
||||
set(imgcodecs_srcs
|
||||
src/loadsave.cpp
|
||||
src/utils.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/loadsave.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/utils.cpp
|
||||
)
|
||||
|
||||
file(GLOB imgcodecs_ext_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB imgcodecs_ext_hdrs
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
|
||||
)
|
||||
|
||||
if(IOS)
|
||||
add_definitions(-DHAVE_IOS=1)
|
||||
list(APPEND imgcodecs_srcs src/ios_conversions.mm)
|
||||
list(APPEND imgcodecs_srcs ${CMAKE_CURRENT_LIST_DIR}/src/ios_conversions.mm)
|
||||
list(APPEND IMGCODECS_LIBRARIES "-framework Accelerate" "-framework CoreGraphics" "-framework CoreImage" "-framework QuartzCore" "-framework AssetsLibrary")
|
||||
endif()
|
||||
|
||||
@ -95,6 +99,7 @@ ocv_module_include_directories()
|
||||
|
||||
ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
|
||||
|
||||
macro(ocv_imgcodecs_configure_target)
|
||||
if(APPLE)
|
||||
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
|
||||
if(HAVE_OBJC_EXCEPTIONS)
|
||||
@ -124,8 +129,12 @@ endif()
|
||||
#stop automatic dependencies propagation for this module
|
||||
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
|
||||
endmacro()
|
||||
|
||||
if(NOT BUILD_opencv_world)
|
||||
ocv_imgcodecs_configure_target()
|
||||
endif()
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -44,7 +44,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv {
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
|
@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// CLAHE
|
||||
|
@ -90,7 +90,7 @@
|
||||
\**********************************************************************************/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
#include <limits>
|
||||
|
||||
#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
|
@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
/****************************************************************************************\
|
||||
Base Image Filter
|
||||
|
@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -47,7 +47,7 @@
|
||||
// */
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
|
@ -39,7 +39,7 @@
|
||||
//
|
||||
//M*/
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <limits.h>
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
/****************************************************************************************\
|
||||
Basic Morphological Operations: Erosion & Dilation
|
||||
|
@ -90,11 +90,8 @@ __kernel void calcSum(__global const uchar * srcptr, int src_step, int src_offse
|
||||
T src = loadpix(srcptr + src_index);
|
||||
|
||||
tmp = convertToWT(src);
|
||||
#if wdepth == 4
|
||||
accumulator = mad24(tmp, tmp, accumulator);
|
||||
#else
|
||||
|
||||
accumulator = mad(tmp, tmp, accumulator);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lid < WGS2_ALIGNED)
|
||||
@ -165,11 +162,9 @@ __kernel void matchTemplate_Naive_CCORR(__global const uchar * srcptr, int src_s
|
||||
{
|
||||
T temp = (T)(template[j]);
|
||||
T src = *(__global const T*)(srcptr + ind + j*(int)sizeof(T1));
|
||||
#if wdepth == 4
|
||||
sum = mad24(convertToWT(src), convertToWT(temp), sum);
|
||||
#else
|
||||
sum = mad(convertToWT(src), convertToWT(temp), sum);
|
||||
#endif
|
||||
|
||||
sum = mad(convertToWT(src), convertToWT(temp), sum);
|
||||
|
||||
}
|
||||
ind += src_step;
|
||||
template = (__global const T1 *)((__global const uchar *)template + template_step);
|
||||
@ -195,12 +190,7 @@ __kernel void matchTemplate_Naive_CCORR(__global const uchar * srcptr, int src_s
|
||||
#pragma unroll
|
||||
for (int cx=0, x = x0; cx < PIX_PER_WI_X && x < dst_cols; ++cx, ++x)
|
||||
{
|
||||
|
||||
#if wdepth == 4
|
||||
sum[cx] = mad24(convertToWT1(src[j+cx]), convertToWT1(template[j]), sum[cx]);
|
||||
#else
|
||||
sum[cx] = mad(convertToWT1(src[j+cx]), convertToWT1(template[j]), sum[cx]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,11 +227,8 @@ __kernel void matchTemplate_Naive_CCORR(__global const uchar * srcptr, int src_s
|
||||
{
|
||||
T src = loadpix(srcptr + mad24(y+i, src_step, mad24(x+j, TSIZE, src_offset)));
|
||||
T template = loadpix(templateptr + mad24(i, template_step, mad24(j, TSIZE, template_offset)));
|
||||
#if wdepth == 4
|
||||
sum = mad24(convertToWT(src), convertToWT(template), sum);
|
||||
#else
|
||||
|
||||
sum = mad(convertToWT(src), convertToWT(template), sum);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,11 +283,8 @@ __kernel void matchTemplate_Naive_SQDIFF(__global const uchar * srcptr, int src_
|
||||
T template = loadpix(templateptr + mad24(i, template_step, mad24(j, TSIZE, template_offset)));
|
||||
|
||||
value = convertToWT(src) - convertToWT(template);
|
||||
#if wdepth == 4
|
||||
sum = mad24(value, value, sum);
|
||||
#else
|
||||
|
||||
sum = mad(value, value, sum);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
/*
|
||||
* This file includes the code, contributed by Simon Perreault
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
|
@ -40,7 +40,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
////////////////////////////////////////////////// matchTemplate //////////////////////////////////////////////////////////
|
||||
|
||||
@ -79,7 +79,7 @@ static bool extractFirstChannel_32F(InputArray _image, OutputArray _result, int
|
||||
static bool sumTemplate(InputArray _src, UMat & result)
|
||||
{
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
int wdepth = std::max(CV_32S, depth), wtype = CV_MAKE_TYPE(wdepth, cn);
|
||||
int wdepth = CV_32F, wtype = CV_MAKE_TYPE(wdepth, cn);
|
||||
size_t wgs = ocl::Device::getDefault().maxWorkGroupSize();
|
||||
|
||||
int wgs2_aligned = 1;
|
||||
@ -89,10 +89,10 @@ static bool sumTemplate(InputArray _src, UMat & result)
|
||||
|
||||
char cvt[40];
|
||||
ocl::Kernel k("calcSum", ocl::imgproc::match_template_oclsrc,
|
||||
format("-D CALC_SUM -D T=%s -D T1=%s -D WT=%s -D cn=%d -D convertToWT=%s -D WGS=%d -D WGS2_ALIGNED=%d -D wdepth=%d",
|
||||
format("-D CALC_SUM -D T=%s -D T1=%s -D WT=%s -D cn=%d -D convertToWT=%s -D WGS=%d -D WGS2_ALIGNED=%d",
|
||||
ocl::typeToStr(type), ocl::typeToStr(depth), ocl::typeToStr(wtype), cn,
|
||||
ocl::convertTypeStr(depth, wdepth, cn, cvt),
|
||||
(int)wgs, wgs2_aligned, wdepth));
|
||||
(int)wgs, wgs2_aligned));
|
||||
if (k.empty())
|
||||
return false;
|
||||
|
||||
@ -110,12 +110,8 @@ static bool sumTemplate(InputArray _src, UMat & result)
|
||||
|
||||
static bool useNaive(Size size)
|
||||
{
|
||||
if (!ocl::Device::getDefault().isIntel())
|
||||
return true;
|
||||
|
||||
int dft_size = 18;
|
||||
return size.height < dft_size && size.width < dft_size;
|
||||
|
||||
}
|
||||
|
||||
struct ConvolveBuf
|
||||
@ -129,7 +125,6 @@ struct ConvolveBuf
|
||||
UMat image_block, templ_block, result_data;
|
||||
|
||||
void create(Size image_size, Size templ_size);
|
||||
static Size estimateBlockSize(Size result_size);
|
||||
};
|
||||
|
||||
void ConvolveBuf::create(Size image_size, Size templ_size)
|
||||
@ -137,19 +132,26 @@ void ConvolveBuf::create(Size image_size, Size templ_size)
|
||||
result_size = Size(image_size.width - templ_size.width + 1,
|
||||
image_size.height - templ_size.height + 1);
|
||||
|
||||
block_size = user_block_size;
|
||||
if (user_block_size.width == 0 || user_block_size.height == 0)
|
||||
block_size = estimateBlockSize(result_size);
|
||||
const double blockScale = 4.5;
|
||||
const int minBlockSize = 256;
|
||||
|
||||
dft_size.width = 1 << int(ceil(std::log(block_size.width + templ_size.width - 1.) / std::log(2.)));
|
||||
dft_size.height = 1 << int(ceil(std::log(block_size.height + templ_size.height - 1.) / std::log(2.)));
|
||||
block_size.width = cvRound(result_size.width*blockScale);
|
||||
block_size.width = std::max( block_size.width, minBlockSize - templ_size.width + 1 );
|
||||
block_size.width = std::min( block_size.width, result_size.width );
|
||||
block_size.height = cvRound(templ_size.height*blockScale);
|
||||
block_size.height = std::max( block_size.height, minBlockSize - templ_size.height + 1 );
|
||||
block_size.height = std::min( block_size.height, result_size.height );
|
||||
|
||||
dft_size.width = getOptimalDFTSize(block_size.width + templ_size.width - 1);
|
||||
dft_size.width = std::max(getOptimalDFTSize(block_size.width + templ_size.width - 1), 2);
|
||||
dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1);
|
||||
if( dft_size.width <= 0 || dft_size.height <= 0 )
|
||||
CV_Error( CV_StsOutOfRange, "the input arrays are too big" );
|
||||
|
||||
// To avoid wasting time doing small DFTs
|
||||
dft_size.width = std::max(dft_size.width, 512);
|
||||
dft_size.height = std::max(dft_size.height, 512);
|
||||
// recompute block size
|
||||
block_size.width = dft_size.width - templ_size.width + 1;
|
||||
block_size.width = std::min( block_size.width, result_size.width);
|
||||
block_size.height = dft_size.height - templ_size.height + 1;
|
||||
block_size.height = std::min( block_size.height, result_size.height );
|
||||
|
||||
image_block.create(dft_size, CV_32F);
|
||||
templ_block.create(dft_size, CV_32F);
|
||||
@ -164,15 +166,6 @@ void ConvolveBuf::create(Size image_size, Size templ_size)
|
||||
block_size.height = std::min(dft_size.height - templ_size.height + 1, result_size.height);
|
||||
}
|
||||
|
||||
Size ConvolveBuf::estimateBlockSize(Size result_size)
|
||||
{
|
||||
int width = (result_size.width + 2) / 3;
|
||||
int height = (result_size.height + 2) / 3;
|
||||
width = std::min(width, result_size.width);
|
||||
height = std::min(height, result_size.height);
|
||||
return Size(width, height);
|
||||
}
|
||||
|
||||
static bool convolve_dft(InputArray _image, InputArray _templ, OutputArray _result)
|
||||
{
|
||||
ConvolveBuf buf;
|
||||
@ -202,7 +195,7 @@ static bool convolve_dft(InputArray _image, InputArray _templ, OutputArray _resu
|
||||
copyMakeBorder(templ_roi, templ_block, 0, templ_block.rows - templ_roi.rows, 0,
|
||||
templ_block.cols - templ_roi.cols, BORDER_ISOLATED);
|
||||
|
||||
dft(templ_block, templ_spect, 0);
|
||||
dft(templ_block, templ_spect, 0, templ.rows);
|
||||
|
||||
// Process all blocks of the result matrix
|
||||
for (int y = 0; y < result.rows; y += block_size.height)
|
||||
@ -281,8 +274,8 @@ static bool matchTemplateNaive_CCORR(InputArray _image, InputArray _templ, Outpu
|
||||
const char* convertToWT = ocl::convertTypeStr(depth, wdepth, rated_cn, cvt1);
|
||||
|
||||
ocl::Kernel k("matchTemplate_Naive_CCORR", ocl::imgproc::match_template_oclsrc,
|
||||
format("-D CCORR -D T=%s -D T1=%s -D WT=%s -D WT1=%s -D convertToWT=%s -D convertToWT1=%s -D cn=%d -D wdepth=%d -D PIX_PER_WI_X=%d", ocl::typeToStr(type), ocl::typeToStr(depth), ocl::typeToStr(wtype1), ocl::typeToStr(wtype),
|
||||
convertToWT, convertToWT1, cn, wdepth, pxPerWIx));
|
||||
format("-D CCORR -D T=%s -D T1=%s -D WT=%s -D WT1=%s -D convertToWT=%s -D convertToWT1=%s -D cn=%d -D PIX_PER_WI_X=%d", ocl::typeToStr(type), ocl::typeToStr(depth), ocl::typeToStr(wtype1), ocl::typeToStr(wtype),
|
||||
convertToWT, convertToWT1, cn, pxPerWIx));
|
||||
if (k.empty())
|
||||
return false;
|
||||
|
||||
@ -358,8 +351,8 @@ static bool matchTemplateNaive_SQDIFF(InputArray _image, InputArray _templ, Outp
|
||||
|
||||
char cvt[40];
|
||||
ocl::Kernel k("matchTemplate_Naive_SQDIFF", ocl::imgproc::match_template_oclsrc,
|
||||
format("-D SQDIFF -D T=%s -D T1=%s -D WT=%s -D convertToWT=%s -D cn=%d -D wdepth=%d", ocl::typeToStr(type), ocl::typeToStr(depth),
|
||||
ocl::typeToStr(wtype), ocl::convertTypeStr(depth, wdepth, cn, cvt), cn, wdepth));
|
||||
format("-D SQDIFF -D T=%s -D T1=%s -D WT=%s -D convertToWT=%s -D cn=%d", ocl::typeToStr(type), ocl::typeToStr(depth),
|
||||
ocl::typeToStr(wtype), ocl::convertTypeStr(depth, wdepth, cn, cvt), cn));
|
||||
if (k.empty())
|
||||
return false;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -43,7 +43,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -48,7 +48,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -52,7 +52,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
#include "iostream"
|
||||
#include "fstream"
|
||||
|
@ -41,7 +41,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
@ -44,7 +44,7 @@
|
||||
//M*/
|
||||
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user