merged the trunk r8669:8702
This commit is contained in:
parent
150aeee58f
commit
6cca6a4548
1
3rdparty/tbb/CMakeLists.txt
vendored
1
3rdparty/tbb/CMakeLists.txt
vendored
@ -114,6 +114,7 @@ add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
|
|||||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||||
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
|
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
|
||||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||||
|
set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
|
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
|
||||||
|
155
cmake/OpenCVConfig.cmake
Normal file
155
cmake/OpenCVConfig.cmake
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
# ===================================================================================
|
||||||
|
# The OpenCV CMake configuration file
|
||||||
|
#
|
||||||
|
# ** File generated automatically, do not modify **
|
||||||
|
#
|
||||||
|
# Usage from an external project:
|
||||||
|
# In your CMakeLists.txt, add these lines:
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE(OpenCV REQUIRED)
|
||||||
|
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
|
||||||
|
#
|
||||||
|
# Or you can search for specific OpenCV modules:
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE(OpenCV REQUIRED core highgui)
|
||||||
|
#
|
||||||
|
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
|
||||||
|
#
|
||||||
|
# This file will define the following variables:
|
||||||
|
# - OpenCV_LIBS : The list of libraries to links against.
|
||||||
|
# - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
|
||||||
|
# with this path is NOT needed.
|
||||||
|
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
||||||
|
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
|
||||||
|
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
|
||||||
|
# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0"
|
||||||
|
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2"
|
||||||
|
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4"
|
||||||
|
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
|
||||||
|
#
|
||||||
|
# Advanced variables:
|
||||||
|
# - OpenCV_SHARED
|
||||||
|
# - OpenCV_CONFIG_PATH
|
||||||
|
# - OpenCV_INSTALL_PATH (not set on Windows)
|
||||||
|
# - OpenCV_LIB_COMPONENTS
|
||||||
|
# - OpenCV_USE_MANGLED_PATHS
|
||||||
|
# - OpenCV_HAVE_ANDROID_CAMERA
|
||||||
|
#
|
||||||
|
# ===================================================================================
|
||||||
|
#
|
||||||
|
# Windows pack specific options:
|
||||||
|
# - OpenCV_STATIC
|
||||||
|
# - OpenCV_CUDA
|
||||||
|
|
||||||
|
if(NOT DEFINED OpenCV_STATIC)
|
||||||
|
# look for global setting
|
||||||
|
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
|
||||||
|
set(OpenCV_STATIC OFF)
|
||||||
|
else()
|
||||||
|
set(OpenCV_STATIC ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED OpenCV_CUDA)
|
||||||
|
# if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries
|
||||||
|
if(CUDA_FOUND)
|
||||||
|
set(OpenCV_CUDA ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
if(CMAKE_CL_64)
|
||||||
|
set(OpenCV_ARCH x64)
|
||||||
|
set(OpenCV_TBB_ARCH intel64)
|
||||||
|
else()
|
||||||
|
set(OpenCV_ARCH x86)
|
||||||
|
set(OpenCV_TBB_ARCH ia32)
|
||||||
|
endif()
|
||||||
|
if(MSVC_VERSION EQUAL 1400)
|
||||||
|
set(OpenCV_RUNTIME vc8)
|
||||||
|
elseif(MSVC_VERSION EQUAL 1500)
|
||||||
|
set(OpenCV_RUNTIME vc9)
|
||||||
|
elseif(MSVC_VERSION EQUAL 1600)
|
||||||
|
set(OpenCV_RUNTIME vc10)
|
||||||
|
elseif(MSVC_VERSION EQUAL 1700)
|
||||||
|
set(OpenCV_RUNTIME vc11)
|
||||||
|
endif()
|
||||||
|
elseif(MINGW)
|
||||||
|
set(OpenCV_RUNTIME mingw)
|
||||||
|
|
||||||
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||||
|
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
|
||||||
|
set(MINGW64 1)
|
||||||
|
set(OpenCV_ARCH x64)
|
||||||
|
else()
|
||||||
|
set(OpenCV_ARCH x86)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 2.6.2)
|
||||||
|
unset(OpenCV_CONFIG_PATH CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
|
||||||
|
if(OpenCV_RUNTIME AND OpenCV_ARCH)
|
||||||
|
if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
|
||||||
|
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
|
||||||
|
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
||||||
|
else()
|
||||||
|
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
||||||
|
endif()
|
||||||
|
elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
|
||||||
|
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
|
||||||
|
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
|
||||||
|
else()
|
||||||
|
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
|
||||||
|
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE)
|
||||||
|
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE)
|
||||||
|
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdpaty OpenCV dependencies are located" FORCE)
|
||||||
|
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdpaty OpenCV dependencies are located" FORCE)
|
||||||
|
|
||||||
|
include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
|
||||||
|
|
||||||
|
if(OpenCV_CUDA)
|
||||||
|
set(_OpenCV_LIBS "")
|
||||||
|
foreach(_lib ${OpenCV_LIBS})
|
||||||
|
string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}")
|
||||||
|
if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}")
|
||||||
|
list(APPEND _OpenCV_LIBS "${_lib2}")
|
||||||
|
else()
|
||||||
|
list(APPEND _OpenCV_LIBS "${_lib}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(OpenCV_LIBS ${_OpenCV_LIBS})
|
||||||
|
endif()
|
||||||
|
set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE)
|
||||||
|
set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
if(NOT OpenCV_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
|
||||||
|
if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
|
||||||
|
get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
|
||||||
|
file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH)
|
||||||
|
message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.")
|
||||||
|
if(OpenCV_LIB_PATH MATCHES "/gpu/")
|
||||||
|
string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}")
|
||||||
|
message(STATUS "GPU support is enabled so you might also need ${_OpenCV_LIB_PATH2} in your PATH (it must go after the ${_OpenCV_LIB_PATH}).")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(NOT OpenCV_FIND_QUIETLY)
|
||||||
|
message(WARNING "Found OpenCV 2.4.0 Windows Super Pack but it has not binaries compatible with your configuration.
|
||||||
|
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.")
|
||||||
|
endif()
|
||||||
|
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||||
|
set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
@ -2,7 +2,10 @@ if(ANDROID)
|
|||||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
||||||
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||||
|
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||||
|
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||||
|
endif()
|
||||||
set(HAVE_TBB 1)
|
set(HAVE_TBB 1)
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
PKG_CHECK_MODULES(TBB tbb)
|
PKG_CHECK_MODULES(TBB tbb)
|
||||||
|
@ -72,17 +72,13 @@ macro(ocv_add_dependencies full_modname)
|
|||||||
list(APPEND ${__depsvar} "${d}")
|
list(APPEND ${__depsvar} "${d}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
unset(__depsvar)
|
||||||
|
|
||||||
|
ocv_list_unique(OPENCV_MODULE_${full_modname}_REQ_DEPS)
|
||||||
|
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS)
|
||||||
|
|
||||||
if(OPENCV_MODULE_${full_modname}_REQ_DEPS)
|
|
||||||
list(REMOVE_DUPLICATES OPENCV_MODULE_${full_modname}_REQ_DEPS)
|
|
||||||
endif()
|
|
||||||
if(OPENCV_MODULE_${full_modname}_OPT_DEPS)
|
|
||||||
list(REMOVE_DUPLICATES OPENCV_MODULE_${full_modname}_OPT_DEPS)
|
|
||||||
endif()
|
|
||||||
set(OPENCV_MODULE_${full_modname}_REQ_DEPS ${OPENCV_MODULE_${full_modname}_REQ_DEPS} CACHE INTERNAL "Required dependencies of ${full_modname} module")
|
set(OPENCV_MODULE_${full_modname}_REQ_DEPS ${OPENCV_MODULE_${full_modname}_REQ_DEPS} CACHE INTERNAL "Required dependencies of ${full_modname} module")
|
||||||
set(OPENCV_MODULE_${full_modname}_OPT_DEPS ${OPENCV_MODULE_${full_modname}_OPT_DEPS} CACHE INTERNAL "Optional dependencies of ${full_modname} module")
|
set(OPENCV_MODULE_${full_modname}_OPT_DEPS ${OPENCV_MODULE_${full_modname}_OPT_DEPS} CACHE INTERNAL "Optional dependencies of ${full_modname} module")
|
||||||
|
|
||||||
unset(__depsvar)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# declare new OpenCV module in current folder
|
# declare new OpenCV module in current folder
|
||||||
@ -105,19 +101,22 @@ macro(ocv_add_module _name)
|
|||||||
")
|
")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#remember module details
|
|
||||||
if(NOT DEFINED the_description)
|
if(NOT DEFINED the_description)
|
||||||
set(the_description "The ${name} OpenCV module")
|
set(the_description "The ${name} OpenCV module")
|
||||||
endif()
|
endif()
|
||||||
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")
|
|
||||||
|
|
||||||
#create option to enable/disable this module
|
|
||||||
if(NOT DEFINED BUILD_${the_module}_INIT)
|
if(NOT DEFINED BUILD_${the_module}_INIT)
|
||||||
set(BUILD_${the_module}_INIT ON)
|
set(BUILD_${the_module}_INIT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# create option to enable/disable this module
|
||||||
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT})
|
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT})
|
||||||
|
|
||||||
|
# remember the module details
|
||||||
|
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")
|
||||||
|
|
||||||
|
# parse list of dependencies
|
||||||
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
||||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module")
|
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module")
|
||||||
set(__ocv_argn__ ${ARGN})
|
set(__ocv_argn__ ${ARGN})
|
||||||
@ -143,28 +142,19 @@ macro(ocv_add_module _name)
|
|||||||
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
|
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#TODO: add submodules if any
|
# TODO: add submodules if any
|
||||||
|
|
||||||
#stop processing of current file
|
# stop processing of current file
|
||||||
return()
|
return()
|
||||||
else(OPENCV_INITIAL_PASS)
|
else(OPENCV_INITIAL_PASS)
|
||||||
if(NOT BUILD_${the_module})
|
if(NOT BUILD_${the_module})
|
||||||
#extra protection from redefinition
|
return() # extra protection from redefinition
|
||||||
return()
|
|
||||||
endif()
|
endif()
|
||||||
project(${the_module})
|
project(${the_module})
|
||||||
endif(OPENCV_INITIAL_PASS)
|
endif(OPENCV_INITIAL_PASS)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Internal macro; disables OpenCV module
|
# excludes module from current configuration
|
||||||
# ocv_module_turn_off(<module name>)
|
|
||||||
macro(__ocv_module_turn_off the_module)
|
|
||||||
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}")
|
|
||||||
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}")
|
|
||||||
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}")
|
|
||||||
set(HAVE_${the_module} OFF CACHE INTERNAL "Module ${the_module} can not be built in current configuration")
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(ocv_module_disable module)
|
macro(ocv_module_disable module)
|
||||||
set(__modname ${module})
|
set(__modname ${module})
|
||||||
if(NOT __modname MATCHES "^opencv_")
|
if(NOT __modname MATCHES "^opencv_")
|
||||||
@ -175,41 +165,46 @@ macro(ocv_module_disable module)
|
|||||||
set(OPENCV_MODULE_${__modname}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${__modname} module sources")
|
set(OPENCV_MODULE_${__modname}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${__modname} module sources")
|
||||||
set(OPENCV_MODULES_DISABLED_FORCE "${OPENCV_MODULES_DISABLED_FORCE}" CACHE INTERNAL "List of OpenCV modules which can not be build in current configuration")
|
set(OPENCV_MODULES_DISABLED_FORCE "${OPENCV_MODULES_DISABLED_FORCE}" CACHE INTERNAL "List of OpenCV modules which can not be build in current configuration")
|
||||||
unset(__modname)
|
unset(__modname)
|
||||||
return()#leave the current folder
|
return() # leave the current folder
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# Internal macro; partly disables OpenCV module
|
||||||
|
macro(__ocv_module_turn_off the_module)
|
||||||
|
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}")
|
||||||
|
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}")
|
||||||
|
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}")
|
||||||
|
set(HAVE_${the_module} OFF CACHE INTERNAL "Module ${the_module} can not be built in current configuration")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Internal macro for dependencies tracking
|
||||||
macro(__ocv_flatten_module_required_dependencies the_module)
|
macro(__ocv_flatten_module_required_dependencies the_module)
|
||||||
set(__flattened_deps "")
|
set(__flattened_deps "")
|
||||||
set(__resolved_deps "")
|
set(__resolved_deps "")
|
||||||
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS})
|
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS})
|
||||||
|
|
||||||
while(__req_depends)
|
while(__req_depends)
|
||||||
list(GET __req_depends 0 __dep)
|
ocv_list_pop_front(__req_depends __dep)
|
||||||
list(REMOVE_AT __req_depends 0)
|
|
||||||
if(__dep STREQUAL the_module)
|
if(__dep STREQUAL the_module)
|
||||||
#TODO: think how to deal with cyclic dependency
|
__ocv_module_turn_off(${the_module}) # TODO: think how to deal with cyclic dependency
|
||||||
__ocv_module_turn_off(${the_module})
|
|
||||||
break()
|
break()
|
||||||
elseif("${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO}" MATCHES "(^|;)${__dep}(;|$)")
|
elseif(";${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO};" MATCHES ";${__dep};")
|
||||||
#depends on disabled module
|
__ocv_module_turn_off(${the_module}) # depends on disabled module
|
||||||
__ocv_module_turn_off(${the_module})
|
|
||||||
break()
|
break()
|
||||||
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
|
elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};")
|
||||||
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)")
|
if(";${__resolved_deps};" MATCHES ";${__dep};")
|
||||||
#all dependencies of this module are already resolved
|
list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved
|
||||||
list(APPEND __flattened_deps "${__dep}")
|
|
||||||
else()
|
else()
|
||||||
#put all required subdependencies before this dependency and mark it as resolved
|
# put all required subdependencies before this dependency and mark it as resolved
|
||||||
list(APPEND __resolved_deps "${__dep}")
|
list(APPEND __resolved_deps "${__dep}")
|
||||||
list(INSERT __req_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${__dep})
|
list(INSERT __req_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${__dep})
|
||||||
endif()
|
endif()
|
||||||
elseif(__dep MATCHES "^opencv_")
|
elseif(__dep MATCHES "^opencv_")
|
||||||
#depends on missing module
|
__ocv_module_turn_off(${the_module}) # depends on missing module
|
||||||
__ocv_module_turn_off(${the_module})
|
message(WARNING "Unknown \"${__dep}\" module is listened in the dependencies of \"${the_module}\" module")
|
||||||
break()
|
break()
|
||||||
else()
|
else()
|
||||||
#skip non-modules
|
# skip non-modules
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
|
||||||
@ -220,37 +215,33 @@ macro(__ocv_flatten_module_required_dependencies the_module)
|
|||||||
set(OPENCV_MODULE_${the_module}_DEPS "")
|
set(OPENCV_MODULE_${the_module}_DEPS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(__resolved_deps)
|
ocv_clear_vars(__resolved_deps __flattened_deps __req_depends __dep)
|
||||||
unset(__flattened_deps)
|
|
||||||
unset(__req_depends)
|
|
||||||
unset(__dep)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Internal macro for dependencies tracking
|
||||||
macro(__ocv_flatten_module_optional_dependencies the_module)
|
macro(__ocv_flatten_module_optional_dependencies the_module)
|
||||||
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
set(__flattened_deps "")
|
||||||
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
set(__resolved_deps "")
|
||||||
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
set(__opt_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS} ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
||||||
|
|
||||||
while(__opt_depends)
|
while(__opt_depends)
|
||||||
list(GET __opt_depends 0 __dep)
|
ocv_list_pop_front(__opt_depends __dep)
|
||||||
list(REMOVE_AT __opt_depends 0)
|
|
||||||
if(__dep STREQUAL the_module)
|
if(__dep STREQUAL the_module)
|
||||||
#TODO: think how to deal with cyclic dependency
|
__ocv_module_turn_off(${the_module}) # TODO: think how to deal with cyclic dependency
|
||||||
__ocv_module_turn_off(${the_module})
|
|
||||||
break()
|
break()
|
||||||
elseif("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
|
elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};")
|
||||||
if(__resolved_deps MATCHES "(^|;)${__dep}(;|$)")
|
if(";${__resolved_deps};" MATCHES ";${__dep};")
|
||||||
#all dependencies of this module are already resolved
|
list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved
|
||||||
list(APPEND __flattened_deps "${__dep}")
|
|
||||||
else()
|
else()
|
||||||
#put all subdependencies before this dependency and mark it as resolved
|
# put all subdependencies before this dependency and mark it as resolved
|
||||||
list(APPEND __resolved_deps "${__dep}")
|
list(APPEND __resolved_deps "${__dep}")
|
||||||
list(INSERT __opt_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${OPENCV_MODULE_${__dep}_OPT_DEPS} ${__dep})
|
list(INSERT __opt_depends 0 ${OPENCV_MODULE_${__dep}_REQ_DEPS} ${OPENCV_MODULE_${__dep}_OPT_DEPS} ${__dep})
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
#skip non-modules or missing modules
|
# skip non-modules or missing modules
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
|
||||||
if(__flattened_deps)
|
if(__flattened_deps)
|
||||||
list(REMOVE_DUPLICATES __flattened_deps)
|
list(REMOVE_DUPLICATES __flattened_deps)
|
||||||
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps})
|
set(OPENCV_MODULE_${the_module}_DEPS ${__flattened_deps})
|
||||||
@ -258,10 +249,7 @@ macro(__ocv_flatten_module_optional_dependencies the_module)
|
|||||||
set(OPENCV_MODULE_${the_module}_DEPS "")
|
set(OPENCV_MODULE_${the_module}_DEPS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(__resolved_deps)
|
ocv_clear_vars(__resolved_deps __flattened_deps __opt_depends __dep)
|
||||||
unset(__flattened_deps)
|
|
||||||
unset(__opt_depends)
|
|
||||||
unset(__dep)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(__ocv_flatten_module_dependencies)
|
macro(__ocv_flatten_module_dependencies)
|
||||||
@ -269,16 +257,16 @@ macro(__ocv_flatten_module_dependencies)
|
|||||||
set(HAVE_${m} OFF CACHE INTERNAL "Module ${m} will not be built in current configuration")
|
set(HAVE_${m} OFF CACHE INTERNAL "Module ${m} will not be built in current configuration")
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(m ${OPENCV_MODULES_BUILD})
|
foreach(m ${OPENCV_MODULES_BUILD})
|
||||||
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will not be built in current configuration")
|
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will be built in current configuration")
|
||||||
__ocv_flatten_module_required_dependencies(${m})
|
__ocv_flatten_module_required_dependencies(${m})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(m ${OPENCV_MODULES_BUILD})
|
foreach(m ${OPENCV_MODULES_BUILD})
|
||||||
__ocv_flatten_module_optional_dependencies(${m})
|
__ocv_flatten_module_optional_dependencies(${m})
|
||||||
|
|
||||||
#dependencies from other modules
|
# save dependencies from other modules
|
||||||
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module")
|
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module")
|
||||||
#extra dependencies
|
# save extra dependencies
|
||||||
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_REQ_DEPS} ${OPENCV_MODULE_${m}_OPT_DEPS})
|
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_REQ_DEPS} ${OPENCV_MODULE_${m}_OPT_DEPS})
|
||||||
if(OPENCV_MODULE_${m}_DEPS_EXT AND OPENCV_MODULE_${m}_DEPS)
|
if(OPENCV_MODULE_${m}_DEPS_EXT AND OPENCV_MODULE_${m}_DEPS)
|
||||||
list(REMOVE_ITEM OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS})
|
list(REMOVE_ITEM OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS})
|
||||||
@ -287,8 +275,15 @@ macro(__ocv_flatten_module_dependencies)
|
|||||||
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module")
|
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# order modules by dependencies
|
||||||
|
set(OPENCV_MODULES_BUILD_ "")
|
||||||
|
foreach(m ${OPENCV_MODULES_BUILD})
|
||||||
|
list(APPEND OPENCV_MODULES_BUILD_ ${OPENCV_MODULE_${m}_DEPS} ${m})
|
||||||
|
endforeach()
|
||||||
|
ocv_list_unique(OPENCV_MODULES_BUILD_)
|
||||||
|
|
||||||
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export")
|
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_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_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@ -300,10 +295,11 @@ macro(ocv_glob_modules)
|
|||||||
endif()
|
endif()
|
||||||
set(__directories_observed "")
|
set(__directories_observed "")
|
||||||
|
|
||||||
#collect modules
|
# collect modules
|
||||||
set(OPENCV_INITIAL_PASS ON)
|
set(OPENCV_INITIAL_PASS ON)
|
||||||
foreach(__path ${ARGN})
|
foreach(__path ${ARGN})
|
||||||
ocv_get_real_path(__path "${__path}")
|
ocv_get_real_path(__path "${__path}")
|
||||||
|
|
||||||
list(FIND __directories_observed "${__path}" __pathIdx)
|
list(FIND __directories_observed "${__path}" __pathIdx)
|
||||||
if(__pathIdx GREATER -1)
|
if(__pathIdx GREATER -1)
|
||||||
message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.")
|
message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.")
|
||||||
@ -316,37 +312,36 @@ macro(ocv_glob_modules)
|
|||||||
foreach(mod ${__ocvmodules})
|
foreach(mod ${__ocvmodules})
|
||||||
ocv_get_real_path(__modpath "${__path}/${mod}")
|
ocv_get_real_path(__modpath "${__path}/${mod}")
|
||||||
if(EXISTS "${__modpath}/CMakeLists.txt")
|
if(EXISTS "${__modpath}/CMakeLists.txt")
|
||||||
|
|
||||||
list(FIND __directories_observed "${__modpath}" __pathIdx)
|
list(FIND __directories_observed "${__modpath}" __pathIdx)
|
||||||
if(__pathIdx GREATER -1)
|
if(__pathIdx GREATER -1)
|
||||||
message(FATAL_ERROR "The module from ${__modpath} is already loaded.")
|
message(FATAL_ERROR "The module from ${__modpath} is already loaded.")
|
||||||
endif()
|
endif()
|
||||||
list(APPEND __directories_observed "${__modpath}")
|
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}")
|
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
unset(__ocvmodules)
|
ocv_clear_vars(__ocvmodules __directories_observed __path __modpath __pathIdx)
|
||||||
unset(__directories_observed)
|
|
||||||
unset(__path)
|
|
||||||
unset(__modpath)
|
|
||||||
unset(__pathIdx)
|
|
||||||
|
|
||||||
#resolve dependencies
|
# resolve dependencies
|
||||||
__ocv_flatten_module_dependencies()
|
__ocv_flatten_module_dependencies()
|
||||||
|
|
||||||
#order modules by dependencies
|
# create modules
|
||||||
set(OPENCV_MODULES_BUILD_ "")
|
|
||||||
foreach(m ${OPENCV_MODULES_BUILD})
|
|
||||||
list(APPEND OPENCV_MODULES_BUILD_ ${OPENCV_MODULE_${m}_DEPS} ${m})
|
|
||||||
endforeach()
|
|
||||||
ocv_list_unique(OPENCV_MODULES_BUILD_)
|
|
||||||
|
|
||||||
#create modules
|
|
||||||
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
|
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
|
||||||
set(OPENCV_INITIAL_PASS OFF)
|
set(OPENCV_INITIAL_PASS OFF)
|
||||||
foreach(m ${OPENCV_MODULES_BUILD_})
|
foreach(m ${OPENCV_MODULES_BUILD})
|
||||||
if(m MATCHES "^opencv_")
|
if(m MATCHES "^opencv_")
|
||||||
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
||||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
||||||
@ -389,7 +384,7 @@ endmacro()
|
|||||||
macro(ocv_module_include_directories)
|
macro(ocv_module_include_directories)
|
||||||
ocv_include_directories("${OPENCV_MODULE_${the_module}_LOCATION}/include"
|
ocv_include_directories("${OPENCV_MODULE_${the_module}_LOCATION}/include"
|
||||||
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"#for precompiled headers
|
"${CMAKE_CURRENT_BINARY_DIR}" # for precompiled headers
|
||||||
)
|
)
|
||||||
ocv_include_modules(${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
ocv_include_modules(${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
||||||
endmacro()
|
endmacro()
|
||||||
@ -417,7 +412,7 @@ macro(ocv_set_module_sources)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# use full paths for module to be independent from the module location
|
# use full paths for module to be independent from the module location
|
||||||
ocv_to_full_paths(OPENCV_MODULE_${the_module}_HEADERS)
|
ocv_convert_to_full_paths(OPENCV_MODULE_${the_module}_HEADERS)
|
||||||
|
|
||||||
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}")
|
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}")
|
||||||
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}")
|
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}")
|
||||||
@ -446,9 +441,11 @@ endmacro()
|
|||||||
# ocv_create_module(SKIP_LINK)
|
# ocv_create_module(SKIP_LINK)
|
||||||
macro(ocv_create_module)
|
macro(ocv_create_module)
|
||||||
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES})
|
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES})
|
||||||
|
|
||||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_dependencies(opencv_modules ${the_module})
|
add_dependencies(opencv_modules ${the_module})
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
@ -495,7 +492,7 @@ macro(ocv_create_module)
|
|||||||
)
|
)
|
||||||
|
|
||||||
# only "public" headers need to be installed
|
# only "public" headers need to be installed
|
||||||
if(OPENCV_MODULE_${the_module}_HEADERS AND OPENCV_MODULES_PUBLIC MATCHES "(^|;)${the_module}(;|$)")
|
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
|
||||||
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
||||||
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
|
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
|
||||||
@ -519,21 +516,8 @@ macro(ocv_add_precompiled_headers the_target)
|
|||||||
else()
|
else()
|
||||||
SET(pch_path "src/")
|
SET(pch_path "src/")
|
||||||
endif()
|
endif()
|
||||||
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp")
|
ocv_add_precompiled_header_to_target(${the_target} "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp")
|
||||||
|
|
||||||
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
|
|
||||||
if(CMAKE_GENERATOR MATCHES Visual)
|
|
||||||
set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.cpp")
|
|
||||||
add_native_precompiled_header(${the_target} ${pch_header})
|
|
||||||
elseif(CMAKE_GENERATOR MATCHES Xcode)
|
|
||||||
add_native_precompiled_header(${the_target} ${pch_header})
|
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
|
|
||||||
add_precompiled_header(${the_target} ${pch_header})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
unset(pch_header)
|
|
||||||
unset(pch_path)
|
unset(pch_path)
|
||||||
unset(${the_target}_pch)
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# short command for adding simple OpenCV module
|
# short command for adding simple OpenCV module
|
||||||
@ -563,7 +547,7 @@ macro(ocv_check_dependencies)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
#auxiliary macro to parse arguments of ocv_add_accuracy_tests and ocv_add_perf_tests commands
|
# auxiliary macro to parse arguments of ocv_add_accuracy_tests and ocv_add_perf_tests commands
|
||||||
macro(__ocv_parse_test_sources tests_type)
|
macro(__ocv_parse_test_sources tests_type)
|
||||||
set(OPENCV_${tests_type}_${the_module}_SOURCES "")
|
set(OPENCV_${tests_type}_${the_module}_SOURCES "")
|
||||||
set(OPENCV_${tests_type}_${the_module}_DEPS "")
|
set(OPENCV_${tests_type}_${the_module}_DEPS "")
|
||||||
@ -593,7 +577,7 @@ endmacro()
|
|||||||
|
|
||||||
# this is a command for adding OpenCV performance tests to the module
|
# this is a command for adding OpenCV performance tests to the module
|
||||||
# ocv_add_perf_tests(<extra_dependencies>)
|
# ocv_add_perf_tests(<extra_dependencies>)
|
||||||
macro(ocv_add_perf_tests)
|
function(ocv_add_perf_tests)
|
||||||
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf")
|
set(perf_path "${CMAKE_CURRENT_SOURCE_DIR}/perf")
|
||||||
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
|
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
|
||||||
__ocv_parse_test_sources(PERF ${ARGN})
|
__ocv_parse_test_sources(PERF ${ARGN})
|
||||||
@ -604,7 +588,7 @@ macro(ocv_add_perf_tests)
|
|||||||
|
|
||||||
if(OCV_DEPENDENCIES_FOUND)
|
if(OCV_DEPENDENCIES_FOUND)
|
||||||
set(the_target "opencv_perf_${name}")
|
set(the_target "opencv_perf_${name}")
|
||||||
#project(${the_target})
|
# project(${the_target})
|
||||||
|
|
||||||
ocv_module_include_directories(${perf_deps} "${perf_path}")
|
ocv_module_include_directories(${perf_deps} "${perf_path}")
|
||||||
|
|
||||||
@ -636,14 +620,14 @@ macro(ocv_add_perf_tests)
|
|||||||
add_dependencies(perf ${the_target})
|
add_dependencies(perf ${the_target})
|
||||||
endif()
|
endif()
|
||||||
else(OCV_DEPENDENCIES_FOUND)
|
else(OCV_DEPENDENCIES_FOUND)
|
||||||
#TODO: warn about unsatisfied dependencies
|
# TODO: warn about unsatisfied dependencies
|
||||||
endif(OCV_DEPENDENCIES_FOUND)
|
endif(OCV_DEPENDENCIES_FOUND)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endfunction()
|
||||||
|
|
||||||
# this is a command for adding OpenCV accuracy/regression tests to the module
|
# 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>)
|
# ocv_add_accuracy_tests([FILES <source group name> <list of sources>] [DEPENDS_ON] <list of extra dependencies>)
|
||||||
macro(ocv_add_accuracy_tests)
|
function(ocv_add_accuracy_tests)
|
||||||
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test")
|
set(test_path "${CMAKE_CURRENT_SOURCE_DIR}/test")
|
||||||
ocv_check_dependencies(${test_deps})
|
ocv_check_dependencies(${test_deps})
|
||||||
if(BUILD_TESTS AND EXISTS "${test_path}")
|
if(BUILD_TESTS AND EXISTS "${test_path}")
|
||||||
@ -655,7 +639,7 @@ macro(ocv_add_accuracy_tests)
|
|||||||
|
|
||||||
if(OCV_DEPENDENCIES_FOUND)
|
if(OCV_DEPENDENCIES_FOUND)
|
||||||
set(the_target "opencv_test_${name}")
|
set(the_target "opencv_test_${name}")
|
||||||
#project(${the_target})
|
# project(${the_target})
|
||||||
|
|
||||||
ocv_module_include_directories(${test_deps} "${test_path}")
|
ocv_module_include_directories(${test_deps} "${test_path}")
|
||||||
|
|
||||||
@ -687,12 +671,12 @@ macro(ocv_add_accuracy_tests)
|
|||||||
|
|
||||||
ocv_add_precompiled_headers(${the_target})
|
ocv_add_precompiled_headers(${the_target})
|
||||||
else(OCV_DEPENDENCIES_FOUND)
|
else(OCV_DEPENDENCIES_FOUND)
|
||||||
#TODO: warn about unsatisfied dependencies
|
# TODO: warn about unsatisfied dependencies
|
||||||
endif(OCV_DEPENDENCIES_FOUND)
|
endif(OCV_DEPENDENCIES_FOUND)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endfunction()
|
||||||
|
|
||||||
# internal macro; finds all link dependencies of module
|
# internal macro; finds all link dependencies of the module
|
||||||
# should be used at the end of CMake processing
|
# should be used at the end of CMake processing
|
||||||
macro(__ocv_track_module_link_dependencies the_module optkind)
|
macro(__ocv_track_module_link_dependencies the_module optkind)
|
||||||
set(${the_module}_MODULE_DEPS_${optkind} "")
|
set(${the_module}_MODULE_DEPS_${optkind} "")
|
||||||
@ -742,7 +726,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
|
|||||||
#ocv_list_reverse(${the_module}_EXTRA_DEPS_${optkind})
|
#ocv_list_reverse(${the_module}_EXTRA_DEPS_${optkind})
|
||||||
|
|
||||||
if(__has_cycle)
|
if(__has_cycle)
|
||||||
#not sure if it can work
|
# not sure if it can work
|
||||||
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}")
|
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -754,13 +738,13 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
|
|||||||
endif()#STATIC_LIBRARY
|
endif()#STATIC_LIBRARY
|
||||||
unset(__module_type)
|
unset(__module_type)
|
||||||
|
|
||||||
#message("${the_module}_MODULE_DEPS_${optkind}")
|
#message("${the_module}_MODULE_DEPS_${optkind}")
|
||||||
#message(" ${${the_module}_MODULE_DEPS_${optkind}}")
|
#message(" ${${the_module}_MODULE_DEPS_${optkind}}")
|
||||||
#message(" ${OPENCV_MODULE_${the_module}_DEPS}")
|
#message(" ${OPENCV_MODULE_${the_module}_DEPS}")
|
||||||
#message("")
|
#message("")
|
||||||
#message("${the_module}_EXTRA_DEPS_${optkind}")
|
#message("${the_module}_EXTRA_DEPS_${optkind}")
|
||||||
#message(" ${${the_module}_EXTRA_DEPS_${optkind}}")
|
#message(" ${${the_module}_EXTRA_DEPS_${optkind}}")
|
||||||
#message("")
|
#message("")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# creates lists of build dependencies needed for external projects
|
# creates lists of build dependencies needed for external projects
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# taken from http://www.vtk.org/Bug/view.php?id=1260 and slightly adjusted
|
# taken from http://public.kitware.com/Bug/view.php?id=1260 and slightly adjusted
|
||||||
|
|
||||||
# - Try to find precompiled headers support for GCC 3.4 and 4.x
|
# - Try to find precompiled headers support for GCC 3.4 and 4.x
|
||||||
# Once done this will define:
|
# Once done this will define:
|
||||||
@ -26,8 +26,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
SET(_PCH_include_prefix "-I")
|
SET(_PCH_include_prefix "-I")
|
||||||
SET(_PCH_isystem_prefix "-isystem")
|
SET(_PCH_isystem_prefix "-isystem")
|
||||||
|
|
||||||
ELSEIF(WIN32)
|
ELSEIF(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||||
SET(PCHSupport_FOUND TRUE) # for experimental msvc support
|
SET(PCHSupport_FOUND TRUE)
|
||||||
SET(_PCH_include_prefix "/I")
|
SET(_PCH_include_prefix "/I")
|
||||||
SET(_PCH_isystem_prefix "/I")
|
SET(_PCH_isystem_prefix "/I")
|
||||||
ELSE()
|
ELSE()
|
||||||
@ -324,3 +324,17 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
||||||
|
|
||||||
|
macro(ocv_add_precompiled_header_to_target the_target pch_header)
|
||||||
|
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
|
||||||
|
if(CMAKE_GENERATOR MATCHES Visual)
|
||||||
|
string(REGEX REPLACE "hpp$" "cpp" ${the_target}_pch "${pch_header}")
|
||||||
|
add_native_precompiled_header(${the_target} ${pch_header})
|
||||||
|
unset(${the_target}_pch)
|
||||||
|
elseif(CMAKE_GENERATOR MATCHES Xcode)
|
||||||
|
add_native_precompiled_header(${the_target} ${pch_header})
|
||||||
|
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
|
||||||
|
add_precompiled_header(${the_target} ${pch_header})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
@ -384,6 +384,17 @@ macro(ocv_list_add_suffix LST SUFFIX)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# gets and removes the first element from list
|
||||||
|
macro(ocv_list_pop_front LST VAR)
|
||||||
|
if(${LST})
|
||||||
|
list(GET ${LST} 0 ${VAR})
|
||||||
|
list(REMOVE_AT ${LST} 0)
|
||||||
|
else()
|
||||||
|
set(${VAR} "")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# simple regex escaping routine (does not cover all cases!!!)
|
# simple regex escaping routine (does not cover all cases!!!)
|
||||||
macro(ocv_regex_escape var regex)
|
macro(ocv_regex_escape var regex)
|
||||||
string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
|
string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
|
||||||
@ -401,7 +412,7 @@ endmacro()
|
|||||||
|
|
||||||
|
|
||||||
# convert list of paths to full paths
|
# convert list of paths to full paths
|
||||||
macro(ocv_to_full_paths VAR)
|
macro(ocv_convert_to_full_paths VAR)
|
||||||
if(${VAR})
|
if(${VAR})
|
||||||
set(__tmp "")
|
set(__tmp "")
|
||||||
foreach(path ${${VAR}})
|
foreach(path ${${VAR}})
|
||||||
|
@ -102,7 +102,7 @@ You need the following tools to be installed:
|
|||||||
#. **Eclipse IDE**
|
#. **Eclipse IDE**
|
||||||
|
|
||||||
Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK.
|
Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK.
|
||||||
For OpenCV 2.4.0 we recommend Eclipse 3.7 (Indigo) or later versions. They work well for OpenCV under both Windows and Linux.
|
For OpenCV 2.4.x we recommend Eclipse 3.7 (Indigo) or later versions. They work well for OpenCV under both Windows and Linux.
|
||||||
|
|
||||||
If you have no Eclipse installed, you can get it from the `download page <http://www.eclipse.org/downloads/>`_.
|
If you have no Eclipse installed, you can get it from the `download page <http://www.eclipse.org/downloads/>`_.
|
||||||
|
|
||||||
@ -154,12 +154,12 @@ Get the OpenCV package for Android development
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
tar -jxvf ~/Downloads/OpenCV-2.4.0-android-bin.tar.bz2
|
tar -jxvf ~/Downloads/OpenCV-2.4.1-android-bin2.tar.bz2
|
||||||
|
|
||||||
For this tutorial I have unpacked OpenCV to the :file:`C:\\Work\\android-opencv\\` directory.
|
For this tutorial I have unpacked OpenCV to the :file:`C:\\Work\\android-opencv\\` directory.
|
||||||
|
|
||||||
.. |opencv_android_bin_pack| replace:: OpenCV-2.4.0-android-bin.tar.bz2
|
.. |opencv_android_bin_pack| replace:: OpenCV-2.4.1-android-bin2.tar.bz2
|
||||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.0/OpenCV-2.4.0-android-bin.tar.bz2/download
|
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.1/OpenCV-2.4.1-android-bin2.tar.bz2/download
|
||||||
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
|
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
|
||||||
.. |seven_zip| replace:: 7-Zip
|
.. |seven_zip| replace:: 7-Zip
|
||||||
.. _seven_zip: http://www.7-zip.org/
|
.. _seven_zip: http://www.7-zip.org/
|
||||||
|
@ -48,10 +48,12 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3
|
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3
|
||||||
#include <Eigen/Core>
|
# include <Eigen/Core>
|
||||||
#include <unsupported/Eigen/MatrixFunctions>
|
# ifdef ANDROID
|
||||||
|
template <typename Scalar> Scalar log2(Scalar v) { using std::log; return log(v)/log(Scalar(2)); }
|
||||||
#include <Eigen/Dense>
|
# endif
|
||||||
|
# include <unsupported/Eigen/MatrixFunctions>
|
||||||
|
# include <Eigen/Dense>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -581,7 +583,7 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
|
|||||||
const double fy = levelCameraMatrix.at<double>(1,1);
|
const double fy = levelCameraMatrix.at<double>(1,1);
|
||||||
const double determinantThreshold = 1e-6;
|
const double determinantThreshold = 1e-6;
|
||||||
|
|
||||||
Mat corresps( levelImage0.size(), levelImage0.type(), CV_32SC1 );
|
Mat corresps( levelImage0.size(), levelImage0.type() );
|
||||||
|
|
||||||
// Run transformation search on current level iteratively.
|
// Run transformation search on current level iteratively.
|
||||||
for( int iter = 0; iter < (*iterCountsPtr)[level]; iter ++ )
|
for( int iter = 0; iter < (*iterCountsPtr)[level]; iter ++ )
|
||||||
|
@ -85,7 +85,6 @@ template<typename _Tp, int cn> class CV_EXPORTS Vec;
|
|||||||
template<typename _Tp, int m, int n> class CV_EXPORTS Matx;
|
template<typename _Tp, int m, int n> class CV_EXPORTS Matx;
|
||||||
|
|
||||||
typedef std::string String;
|
typedef std::string String;
|
||||||
typedef std::basic_string<wchar_t> WString;
|
|
||||||
|
|
||||||
class Mat;
|
class Mat;
|
||||||
class SparseMat;
|
class SparseMat;
|
||||||
@ -110,8 +109,12 @@ template<typename _Tp> class CV_EXPORTS MatIterator_;
|
|||||||
template<typename _Tp> class CV_EXPORTS MatConstIterator_;
|
template<typename _Tp> class CV_EXPORTS MatConstIterator_;
|
||||||
template<typename _Tp> class CV_EXPORTS MatCommaInitializer_;
|
template<typename _Tp> class CV_EXPORTS MatCommaInitializer_;
|
||||||
|
|
||||||
|
#if !defined(ANDROID) || (defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_WCHAR_T)
|
||||||
|
typedef std::basic_string<wchar_t> WString;
|
||||||
|
|
||||||
CV_EXPORTS string fromUtf16(const WString& str);
|
CV_EXPORTS string fromUtf16(const WString& str);
|
||||||
CV_EXPORTS WString toUtf16(const string& str);
|
CV_EXPORTS WString toUtf16(const string& str);
|
||||||
|
#endif
|
||||||
|
|
||||||
CV_EXPORTS string format( const char* fmt, ... );
|
CV_EXPORTS string format( const char* fmt, ... );
|
||||||
CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
|
CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
|
||||||
|
@ -151,7 +151,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
|
|||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
#if !defined(ANDROID) || defined(_GLIBCXX_USE_WCHAR_T)
|
#if !defined(ANDROID) || (defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_WCHAR_T)
|
||||||
string fromUtf16(const WString& str)
|
string fromUtf16(const WString& str)
|
||||||
{
|
{
|
||||||
cv::AutoBuffer<char> _buf(str.size()*4 + 1);
|
cv::AutoBuffer<char> _buf(str.size()*4 + 1);
|
||||||
|
1883
modules/gpu/perf/perf_core.cpp
Normal file
1883
modules/gpu/perf/perf_core.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1005,11 +1005,11 @@ void cv::gpu::BruteForceMatcher_GPU_base::radiusMatchConvert(const Mat& trainIdx
|
|||||||
|
|
||||||
for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr)
|
for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr)
|
||||||
{
|
{
|
||||||
int trainIdx = *trainIdx_ptr;
|
int _trainIdx = *trainIdx_ptr;
|
||||||
int imgIdx = *imgIdx_ptr;
|
int _imgIdx = *imgIdx_ptr;
|
||||||
float distance = *distance_ptr;
|
float _distance = *distance_ptr;
|
||||||
|
|
||||||
DMatch m(queryIdx, trainIdx, imgIdx, distance);
|
DMatch m(queryIdx, _trainIdx, _imgIdx, _distance);
|
||||||
|
|
||||||
curMatches.push_back(m);
|
curMatches.push_back(m);
|
||||||
}
|
}
|
||||||
|
@ -98,17 +98,17 @@ namespace cv { namespace gpu { namespace device
|
|||||||
|
|
||||||
using namespace ::cv::gpu::device;
|
using namespace ::cv::gpu::device;
|
||||||
|
|
||||||
cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size, Size block_size, Size block_stride, Size cell_size,
|
cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_, Size cell_size_,
|
||||||
int nbins, double win_sigma, double threshold_L2hys, bool gamma_correction, int nlevels)
|
int nbins_, double win_sigma_, double threshold_L2hys_, bool gamma_correction_, int nlevels_)
|
||||||
: win_size(win_size),
|
: win_size(win_size_),
|
||||||
block_size(block_size),
|
block_size(block_size_),
|
||||||
block_stride(block_stride),
|
block_stride(block_stride_),
|
||||||
cell_size(cell_size),
|
cell_size(cell_size_),
|
||||||
nbins(nbins),
|
nbins(nbins_),
|
||||||
win_sigma(win_sigma),
|
win_sigma(win_sigma_),
|
||||||
threshold_L2hys(threshold_L2hys),
|
threshold_L2hys(threshold_L2hys_),
|
||||||
gamma_correction(gamma_correction),
|
gamma_correction(gamma_correction_),
|
||||||
nlevels(nlevels)
|
nlevels(nlevels_)
|
||||||
{
|
{
|
||||||
CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 &&
|
CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 &&
|
||||||
(win_size.height - block_size.height) % block_stride.height == 0);
|
(win_size.height - block_size.height) % block_stride.height == 0);
|
||||||
@ -149,9 +149,9 @@ bool cv::gpu::HOGDescriptor::checkDetectorSize() const
|
|||||||
return detector_size == 0 || detector_size == descriptor_size || detector_size == descriptor_size + 1;
|
return detector_size == 0 || detector_size == descriptor_size || detector_size == descriptor_size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
|
void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
|
||||||
{
|
{
|
||||||
std::vector<float> detector_reordered(detector.size());
|
std::vector<float> detector_reordered(_detector.size());
|
||||||
|
|
||||||
size_t block_hist_size = getBlockHistogramSize();
|
size_t block_hist_size = getBlockHistogramSize();
|
||||||
cv::Size blocks_per_img = numPartsWithin(win_size, block_size, block_stride);
|
cv::Size blocks_per_img = numPartsWithin(win_size, block_size, block_stride);
|
||||||
@ -159,7 +159,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
|
|||||||
for (int i = 0; i < blocks_per_img.height; ++i)
|
for (int i = 0; i < blocks_per_img.height; ++i)
|
||||||
for (int j = 0; j < blocks_per_img.width; ++j)
|
for (int j = 0; j < blocks_per_img.width; ++j)
|
||||||
{
|
{
|
||||||
const float* src = &detector[0] + (j * blocks_per_img.height + i) * block_hist_size;
|
const float* src = &_detector[0] + (j * blocks_per_img.height + i) * block_hist_size;
|
||||||
float* dst = &detector_reordered[0] + (i * blocks_per_img.width + j) * block_hist_size;
|
float* dst = &detector_reordered[0] + (i * blocks_per_img.width + j) * block_hist_size;
|
||||||
for (size_t k = 0; k < block_hist_size; ++k)
|
for (size_t k = 0; k < block_hist_size; ++k)
|
||||||
dst[k] = src[k];
|
dst[k] = src[k];
|
||||||
@ -168,7 +168,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
|
|||||||
this->detector.upload(Mat(detector_reordered).reshape(1, 1));
|
this->detector.upload(Mat(detector_reordered).reshape(1, 1));
|
||||||
|
|
||||||
size_t descriptor_size = getDescriptorSize();
|
size_t descriptor_size = getDescriptorSize();
|
||||||
free_coef = detector.size() > descriptor_size ? detector[descriptor_size] : 0;
|
free_coef = _detector.size() > descriptor_size ? _detector[descriptor_size] : 0;
|
||||||
|
|
||||||
CV_Assert(checkDetectorSize());
|
CV_Assert(checkDetectorSize());
|
||||||
}
|
}
|
||||||
@ -190,24 +190,24 @@ cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(int rows, int cols, int type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle)
|
void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, GpuMat& _qangle)
|
||||||
{
|
{
|
||||||
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
|
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
|
||||||
|
|
||||||
// grad.create(img.size(), CV_32FC2);
|
// grad.create(img.size(), CV_32FC2);
|
||||||
grad = getBuffer(img.size(), CV_32FC2, grad_buf);
|
_grad = getBuffer(img.size(), CV_32FC2, grad_buf);
|
||||||
|
|
||||||
// qangle.create(img.size(), CV_8UC2);
|
// qangle.create(img.size(), CV_8UC2);
|
||||||
qangle = getBuffer(img.size(), CV_8UC2, qangle_buf);
|
_qangle = getBuffer(img.size(), CV_8UC2, qangle_buf);
|
||||||
|
|
||||||
float angleScale = (float)(nbins / CV_PI);
|
float angleScale = (float)(nbins / CV_PI);
|
||||||
switch (img.type())
|
switch (img.type())
|
||||||
{
|
{
|
||||||
case CV_8UC1:
|
case CV_8UC1:
|
||||||
hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction);
|
hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);
|
||||||
break;
|
break;
|
||||||
case CV_8UC4:
|
case CV_8UC4:
|
||||||
hog::compute_gradients_8UC4(nbins, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction);
|
hog::compute_gradients_8UC4(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,8 +323,8 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
|
|||||||
|
|
||||||
for (size_t i = 0; i < level_scale.size(); i++)
|
for (size_t i = 0; i < level_scale.size(); i++)
|
||||||
{
|
{
|
||||||
double scale = level_scale[i];
|
double _scale = level_scale[i];
|
||||||
Size sz(cvRound(img.cols / scale), cvRound(img.rows / scale));
|
Size sz(cvRound(img.cols / _scale), cvRound(img.rows / _scale));
|
||||||
GpuMat smaller_img;
|
GpuMat smaller_img;
|
||||||
|
|
||||||
if (sz == img.size())
|
if (sz == img.size())
|
||||||
|
@ -78,7 +78,7 @@ template <typename T>
|
|||||||
struct GraphEdge
|
struct GraphEdge
|
||||||
{
|
{
|
||||||
GraphEdge() {}
|
GraphEdge() {}
|
||||||
GraphEdge(int to, int next, const T& val) : to(to), next(next), val(val) {}
|
GraphEdge(int to_, int next_, const T& val_) : to(to_), next(next_), val(val_) {}
|
||||||
int to;
|
int to;
|
||||||
int next;
|
int next;
|
||||||
T val;
|
T val;
|
||||||
@ -110,7 +110,7 @@ private:
|
|||||||
struct SegmLinkVal
|
struct SegmLinkVal
|
||||||
{
|
{
|
||||||
SegmLinkVal() {}
|
SegmLinkVal() {}
|
||||||
SegmLinkVal(int dr, int dsp) : dr(dr), dsp(dsp) {}
|
SegmLinkVal(int dr_, int dsp_) : dr(dr_), dsp(dsp_) {}
|
||||||
bool operator <(const SegmLinkVal& other) const
|
bool operator <(const SegmLinkVal& other) const
|
||||||
{
|
{
|
||||||
return dr + dsp < other.dr + other.dsp;
|
return dr + dsp < other.dr + other.dsp;
|
||||||
@ -123,8 +123,8 @@ struct SegmLinkVal
|
|||||||
struct SegmLink
|
struct SegmLink
|
||||||
{
|
{
|
||||||
SegmLink() {}
|
SegmLink() {}
|
||||||
SegmLink(int from, int to, const SegmLinkVal& val)
|
SegmLink(int from_, int to_, const SegmLinkVal& val_)
|
||||||
: from(from), to(to), val(val) {}
|
: from(from_), to(to_), val(val_) {}
|
||||||
bool operator <(const SegmLink& other) const
|
bool operator <(const SegmLink& other) const
|
||||||
{
|
{
|
||||||
return val < other.val;
|
return val < other.val;
|
||||||
@ -182,10 +182,10 @@ inline int DjSets::merge(int set1, int set2)
|
|||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Graph<T>::Graph(int numv, int nume_max) : start(numv, -1), edges(nume_max)
|
Graph<T>::Graph(int numv_, int nume_max_) : start(numv_, -1), edges(nume_max_)
|
||||||
{
|
{
|
||||||
this->numv = numv;
|
this->numv = numv_;
|
||||||
this->nume_max = nume_max;
|
this->nume_max = nume_max_;
|
||||||
nume = 0;
|
nume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,10 +193,10 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te
|
|||||||
GpuMat sub2 = sub1.rowRange((k+0)*sub1.rows/2, (k+1)*sub1.rows/2);
|
GpuMat sub2 = sub1.rowRange((k+0)*sub1.rows/2, (k+1)*sub1.rows/2);
|
||||||
|
|
||||||
GpuMat *buf_ptrs[] = { &u[k], &d[k], &l[k], &r[k], &disp_selected_pyr[k] };
|
GpuMat *buf_ptrs[] = { &u[k], &d[k], &l[k], &r[k], &disp_selected_pyr[k] };
|
||||||
for(int r = 0; r < 5; ++r)
|
for(int _r = 0; _r < 5; ++_r)
|
||||||
{
|
{
|
||||||
*buf_ptrs[r] = sub2.rowRange(r * sub2.rows/5, (r+1) * sub2.rows/5);
|
*buf_ptrs[_r] = sub2.rowRange(_r * sub2.rows/5, (_r+1) * sub2.rows/5);
|
||||||
assert(buf_ptrs[r]->cols == cols && buf_ptrs[r]->rows == rows * rthis.nr_plane);
|
assert(buf_ptrs[_r]->cols == cols && buf_ptrs[_r]->rows == rows * rthis.nr_plane);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ Trains an SVM with optimal parameters.
|
|||||||
|
|
||||||
.. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval
|
.. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval
|
||||||
|
|
||||||
:param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to train the model, the others form the test set. So, the SVM algorithm is executed ``k_fold`` times.
|
:param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to test the model, the others form the train set. So, the SVM algorithm is executed ``k_fold`` times.
|
||||||
|
|
||||||
:param \*Grid: Iteration grid for the corresponding SVM parameter.
|
:param \*Grid: Iteration grid for the corresponding SVM parameter.
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - 15-puzzle" --path ./15-puzzle
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - 15-puzzle" --path ./15-puzzle
|
||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - face-detection" --path ./face-detection
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - face-detection" --path ./face-detection
|
||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - image-manipulations" --path ./image-manipulations
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - image-manipulations" --path ./image-manipulations
|
||||||
android update project --target android-11 --name "Tutorial 0 (Basic) - Android Camera" --path ./tutorial-0-androidcamera
|
call android update project --target android-11 --name "Tutorial 0 (Basic) - Android Camera" --path ./tutorial-0-androidcamera
|
||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 1 (Basic) - Add OpenCV" --path ./tutorial-1-addopencv
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 1 (Basic) - Add OpenCV" --path ./tutorial-1-addopencv
|
||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 2 (Basic) - Use OpenCV Camera" --path ./tutorial-2-opencvcamera
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 2 (Basic) - Use OpenCV Camera" --path ./tutorial-2-opencvcamera
|
||||||
android update project --target android-11 --name "Tutorial 3 (Advanced) - Add Native OpenCV" --path ./tutorial-3-native
|
call android update project --target android-11 --name "Tutorial 3 (Advanced) - Add Native OpenCV" --path ./tutorial-3-native
|
||||||
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 4 (Advanced) - Mix Java+Native OpenCV" --path ./tutorial-4-mixed
|
call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 4 (Advanced) - Mix Java+Native OpenCV" --path ./tutorial-4-mixed
|
@ -146,7 +146,7 @@ int main(int argc, char** argv)
|
|||||||
minGradMagnitudes[3] = 1;
|
minGradMagnitudes[3] = 1;
|
||||||
|
|
||||||
const float minDepth = 0.f; //in meters
|
const float minDepth = 0.f; //in meters
|
||||||
const float maxDepth = 3.f; //in meters
|
const float maxDepth = 4.f; //in meters
|
||||||
const float maxDepthDiff = 0.07f; //in meters
|
const float maxDepthDiff = 0.07f; //in meters
|
||||||
|
|
||||||
tm.start();
|
tm.start();
|
||||||
|
44
samples/python2/kmeans.py
Normal file
44
samples/python2/kmeans.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
'''
|
||||||
|
K-means clusterization sample.
|
||||||
|
Usage:
|
||||||
|
kmeans.py
|
||||||
|
|
||||||
|
Keyboard shortcuts:
|
||||||
|
ESC - exit
|
||||||
|
space - generate new distribution
|
||||||
|
'''
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
from gaussian_mix import make_gaussians
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cluster_n = 5
|
||||||
|
img_size = 512
|
||||||
|
|
||||||
|
print __doc__
|
||||||
|
|
||||||
|
# generating bright palette
|
||||||
|
colors = np.zeros((1, cluster_n, 3), np.uint8)
|
||||||
|
colors[0,:] = 255
|
||||||
|
colors[0,:,0] = np.arange(0, 180, 180.0/cluster_n)
|
||||||
|
colors = cv2.cvtColor(colors, cv2.COLOR_HSV2BGR)[0]
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print 'sampling distributions...'
|
||||||
|
points, _ = make_gaussians(cluster_n, img_size)
|
||||||
|
|
||||||
|
term_crit = (cv2.TERM_CRITERIA_EPS, 30, 0.1)
|
||||||
|
ret, labels, centers = cv2.kmeans(points, cluster_n, term_crit, 10, 0)
|
||||||
|
|
||||||
|
img = np.zeros((img_size, img_size, 3), np.uint8)
|
||||||
|
for (x, y), label in zip(np.int32(points), labels.ravel()):
|
||||||
|
c = map(int, colors[label])
|
||||||
|
cv2.circle(img, (x, y), 1, c, -1)
|
||||||
|
|
||||||
|
cv2.imshow('gaussian mixture', img)
|
||||||
|
ch = 0xFF & cv2.waitKey(0)
|
||||||
|
if ch == 27:
|
||||||
|
break
|
||||||
|
cv2.destroyAllWindows()
|
Loading…
x
Reference in New Issue
Block a user