commit
4943b0a73c
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
.DS_Store
|
||||
refman.rst
|
||||
OpenCV4Tegra/
|
||||
tegra/
|
||||
*.user
|
||||
.sw[a-z]
|
||||
.*.swp
|
||||
|
1
3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
1
3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
@ -1,4 +1,3 @@
|
||||
set(NEW_FFMPEG 1)
|
||||
set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
|
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so
vendored
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so
vendored
Executable file
BIN
3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so
vendored
Executable file
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r4.2.0.so
vendored
BIN
3rdparty/lib/armeabi/libnative_camera_r4.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/armeabi/libnative_camera_r4.3.0.so
vendored
Executable file
BIN
3rdparty/lib/armeabi/libnative_camera_r4.3.0.so
vendored
Executable file
Binary file not shown.
BIN
3rdparty/lib/mips/libnative_camera_r4.0.3.so
vendored
BIN
3rdparty/lib/mips/libnative_camera_r4.0.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/mips/libnative_camera_r4.1.1.so
vendored
BIN
3rdparty/lib/mips/libnative_camera_r4.1.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/mips/libnative_camera_r4.2.0.so
vendored
BIN
3rdparty/lib/mips/libnative_camera_r4.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/mips/libnative_camera_r4.3.0.so
vendored
Executable file
BIN
3rdparty/lib/mips/libnative_camera_r4.3.0.so
vendored
Executable file
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r2.3.3.so
vendored
BIN
3rdparty/lib/x86/libnative_camera_r2.3.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r3.0.1.so
vendored
BIN
3rdparty/lib/x86/libnative_camera_r3.0.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r4.0.3.so
vendored
BIN
3rdparty/lib/x86/libnative_camera_r4.0.3.so
vendored
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r4.1.1.so
vendored
BIN
3rdparty/lib/x86/libnative_camera_r4.1.1.so
vendored
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r4.2.0.so
vendored
BIN
3rdparty/lib/x86/libnative_camera_r4.2.0.so
vendored
Binary file not shown.
BIN
3rdparty/lib/x86/libnative_camera_r4.3.0.so
vendored
Executable file
BIN
3rdparty/lib/x86/libnative_camera_r4.3.0.so
vendored
Executable file
Binary file not shown.
10
3rdparty/tbb/CMakeLists.txt
vendored
10
3rdparty/tbb/CMakeLists.txt
vendored
@ -11,7 +11,7 @@ if (WIN32 AND ARM)
|
||||
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz")
|
||||
set(tbb_md5 "108c8c1e481b0aaea61878289eb28b6a")
|
||||
set(tbb_version_file "version_string.ver")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused-parameter)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4702)
|
||||
else()
|
||||
# 4.1 update 2 - works fine
|
||||
set(tbb_ver "tbb41_20130116oss")
|
||||
@ -230,9 +230,15 @@ endif()
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
|
||||
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
if (WIN32)
|
||||
set(tbb_debug_postfix "_debug") # to fit pragmas in _windef.h inside TBB
|
||||
else()
|
||||
set(tbb_debug_postfix ${OPENCV_DEBUG_POSTFIX})
|
||||
endif()
|
||||
|
||||
set_target_properties(tbb
|
||||
PROPERTIES OUTPUT_NAME tbb
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
DEBUG_POSTFIX "${tbb_debug_postfix}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
)
|
||||
|
@ -212,7 +212,7 @@ OCV_OPTION(ENABLE_SSE42 "Enable SSE4.2 instructions"
|
||||
OCV_OPTION(ENABLE_AVX "Enable AVX instructions" OFF IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
|
||||
OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
|
||||
OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
|
||||
|
||||
OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 )
|
||||
|
||||
# uncategorized options
|
||||
# ===================================================
|
||||
@ -296,7 +296,6 @@ endif()
|
||||
# Path for build/platform -specific headers
|
||||
# ----------------------------------------------------------------------------
|
||||
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
|
||||
add_definitions(-DHAVE_CVCONFIG_H)
|
||||
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -370,9 +369,6 @@ if(UNIX)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(NOT APPLE)
|
||||
CHECK_INCLUDE_FILE(alloca.h HAVE_ALLOCA_H)
|
||||
CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)
|
||||
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
|
||||
CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
|
||||
if(ANDROID)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
|
||||
@ -382,7 +378,7 @@ if(UNIX)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DHAVE_ALLOCA -DHAVE_ALLOCA_H -DHAVE_LIBPTHREAD -DHAVE_UNISTD_H)
|
||||
set(HAVE_LIBPTHREAD YES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -607,6 +603,16 @@ if(ANDROID)
|
||||
status(" Android examples:" BUILD_ANDROID_EXAMPLES AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
# ================== Windows RT features ==================
|
||||
if(WIN32)
|
||||
status("")
|
||||
status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO)
|
||||
if (ENABLE_WINRT_MODE)
|
||||
status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH})
|
||||
status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH})
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
# ========================== GUI ==========================
|
||||
status("")
|
||||
status(" GUI: ")
|
||||
|
17
README
17
README
@ -1,17 +0,0 @@
|
||||
OpenCV: open source computer vision library
|
||||
|
||||
Homepage: http://opencv.org
|
||||
Online docs: http://docs.opencv.org
|
||||
Q&A forum: http://answers.opencv.org
|
||||
Dev zone: http://code.opencv.org
|
||||
|
||||
Please read before starting work on a pull request:
|
||||
http://code.opencv.org/projects/opencv/wiki/How_to_contribute
|
||||
|
||||
Summary of guidelines:
|
||||
|
||||
* One pull request per issue;
|
||||
* Choose the right base branch;
|
||||
* Include tests and documentation;
|
||||
* Clean up "oops" commits before submitting;
|
||||
* Follow the coding style guide.
|
23
README.md
Normal file
23
README.md
Normal file
@ -0,0 +1,23 @@
|
||||
### OpenCV: Open Source Computer Vision Library
|
||||
|
||||
#### Resources
|
||||
|
||||
* Homepage: <http://opencv.org>
|
||||
* Docs: <http://docs.opencv.org>
|
||||
* Q&A forum: <http://answers.opencv.org>
|
||||
* Issue tracking: <http://code.opencv.org>
|
||||
|
||||
#### Contributing
|
||||
|
||||
Please read before starting work on a pull request: <http://code.opencv.org/projects/opencv/wiki/How_to_contribute>
|
||||
|
||||
Summary of guidelines:
|
||||
|
||||
* One pull request per issue;
|
||||
* Choose the right base branch;
|
||||
* Include tests and documentation;
|
||||
* Clean up "oops" commits before submitting;
|
||||
* Follow the coding style guide.
|
||||
|
||||
[![Donate OpenCV project](http://opencv.org/wp-content/uploads/2013/07/gittip1.png)](https://www.gittip.com/OpenCV/)
|
||||
[![Donate OpenCV project](http://opencv.org/wp-content/uploads/2013/07/paypal-donate-button.png)](https://www.paypal.com/cgi-bin/webscr?item_name=Donation+to+OpenCV&cmd=_donations&business=accountant%40opencv.org)
|
@ -2,6 +2,40 @@ if(NOT MSVC)
|
||||
message(FATAL_ERROR "CRT options are available only for MSVC")
|
||||
endif()
|
||||
|
||||
#INCLUDE (CheckIncludeFiles)
|
||||
|
||||
if (ENABLE_WINRT_MODE)
|
||||
set(HAVE_WINRT True)
|
||||
|
||||
# search Windows Platform SDK
|
||||
message(STATUS "Checking for Windows Platfrom SDK")
|
||||
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
|
||||
if (WINDOWS_SDK_PATH STREQUAL "")
|
||||
message(ERROR "Windows Platform SDK 8.0 was not found!")
|
||||
set(HAVE_WINRT False)
|
||||
endif()
|
||||
|
||||
#search for Visual Studio 11.0 install directory
|
||||
message(STATUS "Checking for Visual Studio 2012")
|
||||
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE)
|
||||
if (VISUAL_STUDIO_PATH STREQUAL "")
|
||||
message(ERROR "Visual Studio 2012 was not found!")
|
||||
set(HAVE_WINRT False)
|
||||
endif()
|
||||
|
||||
if (HAVE_WINRT)
|
||||
TRY_COMPILE(HAVE_WINRT
|
||||
"${OPENCV_BINARY_DIR}/CMakeFiles/CMakeTmp"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp"
|
||||
CMAKE_FLAGS "\"kernel.lib\" \"user32.lib\""
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
endif()
|
||||
|
||||
if (HAVE_WINRT)
|
||||
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602)
|
||||
endif()
|
||||
endif(ENABLE_WINRT_MODE)
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
|
@ -96,7 +96,11 @@ if(CUDA_FOUND)
|
||||
if(CUDA_GENERATION STREQUAL "Fermi")
|
||||
set(__cuda_arch_bin "2.0 2.1(2.0)")
|
||||
elseif(CUDA_GENERATION STREQUAL "Kepler")
|
||||
set(__cuda_arch_bin "3.0")
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "3.0")
|
||||
else()
|
||||
set(__cuda_arch_bin "3.0 3.5")
|
||||
endif()
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
@ -110,8 +114,12 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED __cuda_arch_bin)
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
set(__cuda_arch_ptx "2.0 3.0")
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
else()
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
|
||||
endif()
|
||||
set(__cuda_arch_ptx "3.0")
|
||||
endif()
|
||||
|
||||
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
|
||||
|
@ -108,7 +108,7 @@ if(PYTHON_EXECUTABLE)
|
||||
OUTPUT_QUIET
|
||||
ERROR_VARIABLE SPHINX_OUTPUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(SPHINX_OUTPUT MATCHES "^Sphinx v([0-9][^ \n]*)")
|
||||
if(SPHINX_OUTPUT MATCHES "Sphinx v([0-9][^ \n]*)")
|
||||
set(SPHINX_VERSION "${CMAKE_MATCH_1}")
|
||||
set(HAVE_SPHINX 1)
|
||||
message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")
|
||||
|
@ -138,9 +138,14 @@ endfunction()
|
||||
# This is auxiliary function called from set_ipp_variables()
|
||||
# to set IPP_LIBRARIES variable in IPP 7.x style
|
||||
# ------------------------------------------------------------------------
|
||||
function(set_ipp_new_libraries)
|
||||
function(set_ipp_new_libraries _LATEST_VERSION)
|
||||
set(IPP_PREFIX "ipp")
|
||||
set(IPP_SUFFIX "_l") # static not threaded libs suffix
|
||||
|
||||
if(${_LATEST_VERSION} VERSION_LESS "8.0")
|
||||
set(IPP_SUFFIX "_l") # static not threaded libs suffix
|
||||
else()
|
||||
set(IPP_SUFFIX "") # static not threaded libs suffix
|
||||
endif()
|
||||
set(IPP_THRD "_t") # static threaded libs suffix
|
||||
set(IPPCORE "core") # core functionality
|
||||
set(IPPSP "s") # signal processing
|
||||
@ -199,7 +204,9 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
# set INCLUDE and LIB folders
|
||||
set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
|
||||
|
||||
if (IPP_X64)
|
||||
if (APPLE)
|
||||
set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE)
|
||||
elseif (IPP_X64)
|
||||
if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64)
|
||||
message(SEND_ERROR "IPP EM64T libraries not found")
|
||||
endif()
|
||||
@ -212,7 +219,7 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
endif()
|
||||
|
||||
# set IPP_LIBRARIES variable (7.x lib names)
|
||||
set_ipp_new_libraries()
|
||||
set_ipp_new_libraries(${_LATEST_VERSION})
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}")
|
||||
|
||||
|
@ -65,3 +65,12 @@ if(WITH_OPENGL)
|
||||
endif()
|
||||
endif()
|
||||
endif(WITH_OPENGL)
|
||||
|
||||
# --- Carbon & Cocoa ---
|
||||
if(APPLE)
|
||||
if(WITH_CARBON)
|
||||
set(HAVE_CARBON YES)
|
||||
elseif(NOT IOS)
|
||||
set(HAVE_COCOA YES)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -36,57 +36,59 @@ if(WITH_TIFF)
|
||||
ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_TIFF AND NOT TIFF_FOUND)
|
||||
ocv_clear_vars(TIFF_LIBRARY TIFF_LIBRARIES TIFF_INCLUDE_DIR)
|
||||
if(NOT TIFF_FOUND)
|
||||
ocv_clear_vars(TIFF_LIBRARY TIFF_LIBRARIES TIFF_INCLUDE_DIR)
|
||||
|
||||
set(TIFF_LIBRARY libtiff)
|
||||
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
|
||||
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
|
||||
ocv_parse_header("${${TIFF_LIBRARY}_SOURCE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
|
||||
if(TIFF_VERSION_CLASSIC AND NOT TIFF_VERSION)
|
||||
set(TIFF_VERSION ${TIFF_VERSION_CLASSIC})
|
||||
endif()
|
||||
|
||||
if(TIFF_BIGTIFF_VERSION AND NOT TIFF_VERSION_BIG)
|
||||
set(TIFF_VERSION_BIG ${TIFF_BIGTIFF_VERSION})
|
||||
endif()
|
||||
|
||||
if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR)
|
||||
list(GET TIFF_INCLUDE_DIR 0 _TIFF_INCLUDE_DIR)
|
||||
if(EXISTS "${_TIFF_INCLUDE_DIR}/tiffvers.h")
|
||||
file(STRINGS "${_TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
|
||||
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
|
||||
unset(tiff_version_str)
|
||||
set(TIFF_LIBRARY libtiff)
|
||||
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
|
||||
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
|
||||
ocv_parse_header("${${TIFF_LIBRARY}_SOURCE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
unset(_TIFF_INCLUDE_DIR)
|
||||
|
||||
if(TIFF_VERSION_CLASSIC AND NOT TIFF_VERSION)
|
||||
set(TIFF_VERSION ${TIFF_VERSION_CLASSIC})
|
||||
endif()
|
||||
|
||||
if(TIFF_BIGTIFF_VERSION AND NOT TIFF_VERSION_BIG)
|
||||
set(TIFF_VERSION_BIG ${TIFF_BIGTIFF_VERSION})
|
||||
endif()
|
||||
|
||||
if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR)
|
||||
list(GET TIFF_INCLUDE_DIR 0 _TIFF_INCLUDE_DIR)
|
||||
if(EXISTS "${_TIFF_INCLUDE_DIR}/tiffvers.h")
|
||||
file(STRINGS "${_TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
|
||||
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
|
||||
unset(tiff_version_str)
|
||||
endif()
|
||||
unset(_TIFF_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
set(HAVE_TIFF YES)
|
||||
endif()
|
||||
|
||||
# --- libjpeg (optional) ---
|
||||
if(WITH_JPEG AND NOT IOS)
|
||||
if(WITH_JPEG)
|
||||
if(BUILD_JPEG)
|
||||
ocv_clear_vars(JPEG_FOUND)
|
||||
else()
|
||||
include(FindJPEG)
|
||||
endif()
|
||||
|
||||
if(NOT JPEG_FOUND)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
|
||||
|
||||
set(JPEG_LIBRARY libjpeg)
|
||||
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
ocv_parse_header("${JPEG_INCLUDE_DIR}/jpeglib.h" JPEG_VERSION_LINES JPEG_LIB_VERSION)
|
||||
set(HAVE_JPEG YES)
|
||||
endif()
|
||||
|
||||
if(WITH_JPEG AND NOT JPEG_FOUND)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
|
||||
|
||||
set(JPEG_LIBRARY libjpeg)
|
||||
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
ocv_parse_header("${JPEG_INCLUDE_DIR}/jpeglib.h" JPEG_VERSION_LINES JPEG_LIB_VERSION)
|
||||
|
||||
|
||||
# --- libjasper (optional, should be searched after libjpeg) ---
|
||||
if(WITH_JASPER)
|
||||
if(BUILD_JASPER)
|
||||
@ -94,19 +96,21 @@ if(WITH_JASPER)
|
||||
else()
|
||||
include(FindJasper)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JASPER AND NOT JASPER_FOUND)
|
||||
ocv_clear_vars(JASPER_LIBRARY JASPER_LIBRARIES JASPER_INCLUDE_DIR)
|
||||
if(NOT JASPER_FOUND)
|
||||
ocv_clear_vars(JASPER_LIBRARY JASPER_LIBRARIES JASPER_INCLUDE_DIR)
|
||||
|
||||
set(JASPER_LIBRARY libjasper)
|
||||
set(JASPER_LIBRARIES ${JASPER_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
|
||||
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
set(JASPER_LIBRARY libjasper)
|
||||
set(JASPER_LIBRARIES ${JASPER_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
|
||||
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT JASPER_VERSION_STRING)
|
||||
ocv_parse_header2(JASPER "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" JAS_VERSION "")
|
||||
set(HAVE_JASPER YES)
|
||||
|
||||
if(NOT JASPER_VERSION_STRING)
|
||||
ocv_parse_header2(JASPER "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" JAS_VERSION "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- libpng (optional, should be searched after zlib) ---
|
||||
@ -117,30 +121,30 @@ if(WITH_PNG AND NOT IOS)
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("${PNG_PNG_INCLUDE_DIR}/png.h" HAVE_PNG_H)
|
||||
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
|
||||
if(HAVE_PNG_H)
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
elseif(HAVE_LIBPNG_PNG_H)
|
||||
if(HAVE_LIBPNG_PNG_H)
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
else()
|
||||
ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT PNG_FOUND)
|
||||
ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
|
||||
|
||||
set(PNG_LIBRARY libpng)
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
|
||||
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
|
||||
set(PNG_DEFINITIONS "")
|
||||
ocv_parse_header("${PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
|
||||
set(HAVE_PNG YES)
|
||||
set(PNG_VERSION "${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(WITH_PNG AND NOT PNG_FOUND)
|
||||
ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_PNG_H HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
|
||||
|
||||
set(PNG_LIBRARY libpng)
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
|
||||
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
|
||||
set(PNG_DEFINITIONS "")
|
||||
ocv_parse_header("${PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
|
||||
set(PNG_VERSION "${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}")
|
||||
|
||||
# --- OpenEXR (optional) ---
|
||||
if(WITH_OPENEXR)
|
||||
if(BUILD_OPENEXR)
|
||||
@ -148,17 +152,24 @@ if(WITH_OPENEXR)
|
||||
else()
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENEXR AND NOT OPENEXR_FOUND)
|
||||
ocv_clear_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
|
||||
if(NOT OPENEXR_FOUND)
|
||||
ocv_clear_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
|
||||
|
||||
set(OPENEXR_LIBRARIES IlmImf)
|
||||
set(OPENEXR_ILMIMF_LIBRARY IlmImf)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/openexr")
|
||||
set(OPENEXR_LIBRARIES IlmImf)
|
||||
set(OPENEXR_ILMIMF_LIBRARY IlmImf)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/openexr")
|
||||
endif()
|
||||
|
||||
set(HAVE_OPENEXR YES)
|
||||
endif()
|
||||
|
||||
#cmake 2.8.2 bug - it fails to determine zlib version
|
||||
if(ZLIB_FOUND)
|
||||
ocv_parse_header2(ZLIB "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- Apple ImageIO ---
|
||||
if(WITH_IMAGEIO)
|
||||
set(HAVE_IMAGEIO YES)
|
||||
endif()
|
||||
|
@ -58,7 +58,14 @@ if(WITH_PVAPI)
|
||||
set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_OPENCV_GCC_VERSION_MAJOR}.${CMAKE_OPENCV_GCC_VERSION_MINOR}")
|
||||
endif()
|
||||
|
||||
set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_STATIC_LIBRARY_PREFIX}PvAPI${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE PATH "The PvAPI library")
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
set(PVAPI_DEFINITIONS "-DPVDECL=__stdcall")
|
||||
endif(MINGW)
|
||||
set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/PvAPI.lib" CACHE PATH "The PvAPI library")
|
||||
else(WIN32)
|
||||
set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_STATIC_LIBRARY_PREFIX}PvAPI${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE PATH "The PvAPI library")
|
||||
endif(WIN32)
|
||||
if(EXISTS "${PVAPI_LIBRARY}")
|
||||
set(HAVE_PVAPI TRUE)
|
||||
endif()
|
||||
@ -228,3 +235,13 @@ if(WIN32)
|
||||
list(APPEND HIGHGUI_LIBRARIES winmm)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
# --- Apple AV Foundation ---
|
||||
if(WITH_AVFOUNDATION)
|
||||
set(HAVE_AVFOUNDATION YES)
|
||||
endif()
|
||||
|
||||
# --- QuickTime ---
|
||||
if(WITH_QUICKTIME)
|
||||
set(HAVE_QUICKTIME YES)
|
||||
endif()
|
||||
|
@ -1,13 +1,3 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# Variables for cvconfig.h.cmake
|
||||
# ----------------------------------------------------------------------------
|
||||
set(PACKAGE "opencv")
|
||||
set(PACKAGE_BUGREPORT "opencvlibrary-devel@lists.sourceforge.net")
|
||||
set(PACKAGE_NAME "opencv")
|
||||
set(PACKAGE_STRING "${PACKAGE} ${OPENCV_VERSION}")
|
||||
set(PACKAGE_TARNAME "${PACKAGE}")
|
||||
set(PACKAGE_VERSION "${OPENCV_VERSION}")
|
||||
|
||||
# platform-specific config file
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
|
||||
|
||||
|
@ -12,7 +12,6 @@ set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "") #TODO: need link paths for OpenCV_EXTRA_COMPONENTS
|
||||
set(includedir "\${prefix}/${OPENCV_INCLUDE_INSTALL_PATH}")
|
||||
set(VERSION ${OPENCV_VERSION})
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
set(ocv_optkind OPT)
|
||||
|
@ -470,8 +470,16 @@ endmacro()
|
||||
# ocv_create_module(<extra link dependencies>)
|
||||
# ocv_create_module(SKIP_LINK)
|
||||
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")
|
||||
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}
|
||||
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")
|
||||
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp"
|
||||
${${the_module}_pch})
|
||||
|
||||
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})
|
||||
@ -508,7 +516,8 @@ macro(ocv_create_module)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if((NOT DEFINED OPENCV_MODULE_TYPE AND BUILD_SHARED_LIBS)
|
||||
OR (DEFINED OPENCV_MODULE_TYPE AND OPENCV_MODULE_TYPE STREQUAL SHARED))
|
||||
if(MSVC)
|
||||
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
|
||||
else()
|
||||
@ -636,7 +645,9 @@ function(ocv_add_perf_tests)
|
||||
set(OPENCV_PERF_${the_module}_SOURCES ${perf_srcs} ${perf_hdrs})
|
||||
endif()
|
||||
|
||||
add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES})
|
||||
get_native_precompiled_header(${the_target} test_precomp.hpp)
|
||||
|
||||
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})
|
||||
add_dependencies(opencv_perf_tests ${the_target})
|
||||
|
||||
@ -684,7 +695,9 @@ function(ocv_add_accuracy_tests)
|
||||
set(OPENCV_TEST_${the_module}_SOURCES ${test_srcs} ${test_hdrs})
|
||||
endif()
|
||||
|
||||
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES})
|
||||
get_native_precompiled_header(${the_target} test_precomp.hpp)
|
||||
|
||||
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} ${${the_target}_pch})
|
||||
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
|
||||
|
@ -272,12 +272,9 @@ ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||
SET(_dummy_str "#include \"${_input}\"\n"
|
||||
"// This is required to suppress LNK4221. Very annoying.\n"
|
||||
"void *g_${_targetName}Dummy = 0\;\n")
|
||||
set(_dummy_str "#include \"${_input}\"\n")
|
||||
|
||||
# Use of cxx extension for generated files (as Qt does)
|
||||
SET(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cxx)
|
||||
set(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cpp)
|
||||
if(EXISTS ${${_targetName}_pch})
|
||||
# Check if contents is the same, if not rewrite
|
||||
# todo
|
||||
@ -337,11 +334,7 @@ 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)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual" OR 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})
|
||||
|
6
cmake/checks/winrttest.cpp
Normal file
6
cmake/checks/winrttest.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <wrl/client.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#cmakedefine CRAY_STACKSEG_END
|
||||
/* OpenCV compiled as static or dynamic libs */
|
||||
#cmakedefine BUILD_SHARED_LIBS
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#cmakedefine C_ALLOCA
|
||||
/* Compile for 'real' NVIDIA GPU architectures */
|
||||
#define CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN}"
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#cmakedefine HAVE_ALLOCA 1
|
||||
/* Create PTX or BIN for 1.0 compute capability */
|
||||
#cmakedefine CUDA_ARCH_BIN_OR_PTX_10
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
||||
*/
|
||||
#cmakedefine HAVE_ALLOCA_H 1
|
||||
/* NVIDIA GPU features are used */
|
||||
#define CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES}"
|
||||
|
||||
/* Video for Windows support */
|
||||
#cmakedefine HAVE_VFW
|
||||
/* Compile for 'virtual' NVIDIA PTX architectures */
|
||||
#define CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX}"
|
||||
|
||||
/* AVFoundation video libraries */
|
||||
#cmakedefine HAVE_AVFOUNDATION
|
||||
|
||||
/* V4L capturing support */
|
||||
#cmakedefine HAVE_CAMV4L
|
||||
@ -22,15 +22,30 @@
|
||||
/* V4L2 capturing support */
|
||||
#cmakedefine HAVE_CAMV4L2
|
||||
|
||||
/* V4L2 capturing support in videoio.h */
|
||||
#cmakedefine HAVE_VIDEOIO
|
||||
|
||||
/* V4L/V4L2 capturing support via libv4l */
|
||||
#cmakedefine HAVE_LIBV4L
|
||||
|
||||
/* Carbon windowing environment */
|
||||
#cmakedefine HAVE_CARBON
|
||||
|
||||
/* AMD's Basic Linear Algebra Subprograms Library*/
|
||||
#cmakedefine HAVE_CLAMDBLAS
|
||||
|
||||
/* AMD's OpenCL Fast Fourier Transform Library*/
|
||||
#cmakedefine HAVE_CLAMDFFT
|
||||
|
||||
/* Cocoa API */
|
||||
#cmakedefine HAVE_COCOA
|
||||
|
||||
/* C= */
|
||||
#cmakedefine HAVE_CSTRIPES
|
||||
|
||||
/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
|
||||
#cmakedefine HAVE_CUBLAS
|
||||
|
||||
/* NVidia Cuda Runtime API*/
|
||||
#cmakedefine HAVE_CUDA
|
||||
|
||||
/* NVidia Cuda Fast Fourier Transform (FFT) API*/
|
||||
#cmakedefine HAVE_CUFFT
|
||||
|
||||
/* IEEE1394 capturing support */
|
||||
#cmakedefine HAVE_DC1394
|
||||
|
||||
@ -40,197 +55,109 @@
|
||||
/* IEEE1394 capturing support - libdc1394 v2.x */
|
||||
#cmakedefine HAVE_DC1394_2
|
||||
|
||||
/* DirectShow Video Capture library */
|
||||
#cmakedefine HAVE_DSHOW
|
||||
|
||||
/* Eigen Matrix & Linear Algebra Library */
|
||||
#cmakedefine HAVE_EIGEN
|
||||
|
||||
/* FFMpeg video library */
|
||||
#cmakedefine HAVE_FFMPEG
|
||||
|
||||
/* ffmpeg's libswscale */
|
||||
#cmakedefine HAVE_FFMPEG_SWSCALE
|
||||
|
||||
/* ffmpeg in Gentoo */
|
||||
#cmakedefine HAVE_GENTOO_FFMPEG
|
||||
|
||||
/* FFMpeg video library */
|
||||
#cmakedefine HAVE_FFMPEG
|
||||
|
||||
/* FFMpeg version flag */
|
||||
#cmakedefine NEW_FFMPEG
|
||||
|
||||
/* ffmpeg's libswscale */
|
||||
#cmakedefine HAVE_FFMPEG_SWSCALE
|
||||
|
||||
/* GStreamer multimedia framework */
|
||||
#cmakedefine HAVE_GSTREAMER
|
||||
#cmakedefine HAVE_GSTREAMER
|
||||
|
||||
/* GTK+ 2.0 Thread support */
|
||||
#cmakedefine HAVE_GTHREAD
|
||||
#cmakedefine HAVE_GTHREAD
|
||||
|
||||
/* Windows Runtime support */
|
||||
#cmakedefine HAVE_WINRT
|
||||
|
||||
/* Win32 UI */
|
||||
#cmakedefine HAVE_WIN32UI
|
||||
|
||||
/* GTK+ 2.x toolkit */
|
||||
#cmakedefine HAVE_GTK
|
||||
|
||||
/* OpenEXR codec */
|
||||
#cmakedefine HAVE_ILMIMF
|
||||
#cmakedefine HAVE_GTK
|
||||
|
||||
/* Apple ImageIO Framework */
|
||||
#cmakedefine HAVE_IMAGEIO
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
/* JPEG-2000 codec */
|
||||
#cmakedefine HAVE_JASPER
|
||||
|
||||
/* IJG JPEG codec */
|
||||
#cmakedefine HAVE_JPEG
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#cmakedefine HAVE_LIBDL 1
|
||||
|
||||
/* Define to 1 if you have the `gomp' library (-lgomp). */
|
||||
#cmakedefine HAVE_LIBGOMP 1
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#cmakedefine HAVE_LIBM 1
|
||||
|
||||
/* libpng/png.h needs to be included */
|
||||
#cmakedefine HAVE_LIBPNG_PNG_H
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#cmakedefine HAVE_LIBPTHREAD 1
|
||||
|
||||
/* Define to 1 if you have the `lrint' function. */
|
||||
#cmakedefine HAVE_LRINT 1
|
||||
|
||||
/* PNG codec */
|
||||
#cmakedefine HAVE_PNG
|
||||
|
||||
/* Define to 1 if you have the `png_get_valid' function. */
|
||||
#cmakedefine HAVE_PNG_GET_VALID 1
|
||||
|
||||
/* png.h needs to be included */
|
||||
#cmakedefine HAVE_PNG_H
|
||||
|
||||
/* Define to 1 if you have the `png_set_tRNS_to_alpha' function. */
|
||||
#cmakedefine HAVE_PNG_SET_TRNS_TO_ALPHA 1
|
||||
|
||||
/* QuickTime video libraries */
|
||||
#cmakedefine HAVE_QUICKTIME
|
||||
|
||||
/* AVFoundation video libraries */
|
||||
#cmakedefine HAVE_AVFOUNDATION
|
||||
|
||||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Unicap video capture library */
|
||||
#cmakedefine HAVE_UNICAP
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* Xine video library */
|
||||
#cmakedefine HAVE_XINE
|
||||
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI
|
||||
|
||||
/* LZ77 compression/decompression library (used for PNG) */
|
||||
#cmakedefine HAVE_ZLIB
|
||||
#cmakedefine HAVE_IMAGEIO
|
||||
|
||||
/* Intel Integrated Performance Primitives */
|
||||
#cmakedefine HAVE_IPP
|
||||
#cmakedefine HAVE_IPP
|
||||
|
||||
/* OpenCV compiled as static or dynamic libs */
|
||||
#cmakedefine BUILD_SHARED_LIBS
|
||||
/* JPEG-2000 codec */
|
||||
#cmakedefine HAVE_JASPER
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "${PACKAGE}"
|
||||
/* IJG JPEG codec */
|
||||
#cmakedefine HAVE_JPEG
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"
|
||||
/* libpng/png.h needs to be included */
|
||||
#cmakedefine HAVE_LIBPNG_PNG_H
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "${PACKAGE_NAME}"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "${PACKAGE_STRING}"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "${PACKAGE_TARNAME}"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "${PACKAGE_VERSION}"
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#cmakedefine STACK_DIRECTION
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "${PACKAGE_VERSION}"
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
/* C= */
|
||||
#cmakedefine HAVE_CSTRIPES
|
||||
|
||||
/* Eigen Matrix & Linear Algebra Library */
|
||||
#cmakedefine HAVE_EIGEN
|
||||
|
||||
/* NVidia Cuda Runtime API*/
|
||||
#cmakedefine HAVE_CUDA
|
||||
|
||||
/* NVidia Cuda Fast Fourier Transform (FFT) API*/
|
||||
#cmakedefine HAVE_CUFFT
|
||||
|
||||
/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
|
||||
#cmakedefine HAVE_CUBLAS
|
||||
|
||||
/* NVidia Video Decoding API*/
|
||||
#cmakedefine HAVE_NVCUVID
|
||||
|
||||
/* Compile for 'real' NVIDIA GPU architectures */
|
||||
#define CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN}"
|
||||
|
||||
/* Compile for 'virtual' NVIDIA PTX architectures */
|
||||
#define CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX}"
|
||||
|
||||
/* NVIDIA GPU features are used */
|
||||
#define CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES}"
|
||||
|
||||
/* Create PTX or BIN for 1.0 compute capability */
|
||||
#cmakedefine CUDA_ARCH_BIN_OR_PTX_10
|
||||
|
||||
/* OpenCL Support */
|
||||
#cmakedefine HAVE_OPENCL
|
||||
|
||||
/* AMD's OpenCL Fast Fourier Transform Library*/
|
||||
#cmakedefine HAVE_CLAMDFFT
|
||||
|
||||
/* AMD's Basic Linear Algebra Subprograms Library*/
|
||||
#cmakedefine HAVE_CLAMDBLAS
|
||||
|
||||
/* DirectShow Video Capture library */
|
||||
#cmakedefine HAVE_DSHOW
|
||||
/* V4L/V4L2 capturing support via libv4l */
|
||||
#cmakedefine HAVE_LIBV4L
|
||||
|
||||
/* Microsoft Media Foundation Capture library */
|
||||
#cmakedefine HAVE_MSMF
|
||||
|
||||
/* XIMEA camera support */
|
||||
#cmakedefine HAVE_XIMEA
|
||||
/* NVidia Video Decoding API*/
|
||||
#cmakedefine HAVE_NVCUVID
|
||||
|
||||
/* OpenCL Support */
|
||||
#cmakedefine HAVE_OPENCL
|
||||
|
||||
/* OpenEXR codec */
|
||||
#cmakedefine HAVE_OPENEXR
|
||||
|
||||
/* OpenGL support*/
|
||||
#cmakedefine HAVE_OPENGL
|
||||
|
||||
/* Clp support */
|
||||
#cmakedefine HAVE_CLP
|
||||
/* OpenNI library */
|
||||
#cmakedefine HAVE_OPENNI
|
||||
|
||||
/* PNG codec */
|
||||
#cmakedefine HAVE_PNG
|
||||
|
||||
/* Qt support */
|
||||
#cmakedefine HAVE_QT
|
||||
|
||||
/* Qt OpenGL support */
|
||||
#cmakedefine HAVE_QT_OPENGL
|
||||
|
||||
/* QuickTime video libraries */
|
||||
#cmakedefine HAVE_QUICKTIME
|
||||
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Unicap video capture library */
|
||||
#cmakedefine HAVE_UNICAP
|
||||
|
||||
/* Video for Windows support */
|
||||
#cmakedefine HAVE_VFW
|
||||
|
||||
/* V4L2 capturing support in videoio.h */
|
||||
#cmakedefine HAVE_VIDEOIO
|
||||
|
||||
/* Win32 UI */
|
||||
#cmakedefine HAVE_WIN32UI
|
||||
|
||||
/* XIMEA camera support */
|
||||
#cmakedefine HAVE_XIMEA
|
||||
|
||||
/* Xine video library */
|
||||
#cmakedefine HAVE_XINE
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
|
@ -8,6 +8,6 @@ includedir_new=@includedir@
|
||||
|
||||
Name: OpenCV
|
||||
Description: Open Source Computer Vision Library
|
||||
Version: @VERSION@
|
||||
Version: @OPENCV_VERSION@
|
||||
Libs: @OpenCV_LIB_COMPONENTS@
|
||||
Cflags: -I${includedir_old} -I${includedir_new}
|
||||
|
@ -49,7 +49,7 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
set(toc_file "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst")
|
||||
if(EXISTS "${toc_file}")
|
||||
file(RELATIVE_PATH toc_file "${OpenCV_SOURCE_DIR}/modules" "${toc_file}")
|
||||
set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${toc_file}\r\n")
|
||||
set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${toc_file}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
@ -3,42 +3,42 @@
|
||||
Camera calibration With OpenCV
|
||||
******************************
|
||||
|
||||
Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole* cameras in the late 20th century, they became a common occurrence in our everyday life. Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are constants and with a calibration and some remapping we can correct this. Furthermore, with calibration you may also determinate the relation between the camera's natural units (pixels) and the real world units (for example millimeters).
|
||||
Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole* cameras in the late 20th century, they became a common occurrence in our everyday life. Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are constants and with a calibration and some remapping we can correct this. Furthermore, with calibration you may also determine the relation between the camera's natural units (pixels) and the real world units (for example millimeters).
|
||||
|
||||
Theory
|
||||
======
|
||||
|
||||
For the distortion OpenCV takes into account the radial and tangential factors. For the radial one uses the following formula:
|
||||
For the distortion OpenCV takes into account the radial and tangential factors. For the radial factor one uses the following formula:
|
||||
|
||||
.. math::
|
||||
|
||||
x_{corrected} = x( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6) \\
|
||||
y_{corrected} = y( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6)
|
||||
|
||||
So for an old pixel point at :math:`(x,y)` coordinate in the input image, for a corrected output image its position will be :math:`(x_{corrected} y_{corrected})` . The presence of the radial distortion manifests in form of the "barrel" or "fish-eye" effect.
|
||||
So for an old pixel point at :math:`(x,y)` coordinates in the input image, its position on the corrected output image will be :math:`(x_{corrected} y_{corrected})`. The presence of the radial distortion manifests in form of the "barrel" or "fish-eye" effect.
|
||||
|
||||
Tangential distortion occurs because the image taking lenses are not perfectly parallel to the imaging plane. Correcting this is made via the formulas:
|
||||
Tangential distortion occurs because the image taking lenses are not perfectly parallel to the imaging plane. It can be corrected via the formulas:
|
||||
|
||||
.. math::
|
||||
|
||||
x_{corrected} = x + [ 2p_1xy + p_2(r^2+2x^2)] \\
|
||||
y_{corrected} = y + [ p_1(r^2+ 2y^2)+ 2p_2xy]
|
||||
|
||||
So we have five distortion parameters, which in OpenCV are organized in a 5 column one row matrix:
|
||||
So we have five distortion parameters which in OpenCV are presented as one row matrix with 5 columns:
|
||||
|
||||
.. math::
|
||||
|
||||
Distortion_{coefficients}=(k_1 \hspace{10pt} k_2 \hspace{10pt} p_1 \hspace{10pt} p_2 \hspace{10pt} k_3)
|
||||
|
||||
Now for the unit conversion, we use the following formula:
|
||||
Now for the unit conversion we use the following formula:
|
||||
|
||||
.. math::
|
||||
|
||||
\left [ \begin{matrix} x \\ y \\ w \end{matrix} \right ] = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \left [ \begin{matrix} X \\ Y \\ Z \end{matrix} \right ]
|
||||
|
||||
Here the presence of the :math:`w` is cause we use a homography coordinate system (and :math:`w=Z`). The unknown parameters are :math:`f_x` and :math:`f_y` (camera focal lengths) and :math:`(c_x, c_y)` what are the optical centers expressed in pixels coordinates. If for both axes a common focal length is used with a given :math:`a` aspect ratio (usually 1), then :math:`f_y=f_x*a` and in the upper formula we will have a single :math:`f` focal length. The matrix containing these four parameters is referred to as the *camera matrix*. While the distortion coefficients are the same regardless of the camera resolutions used, these should be scaled along with the current resolution from the calibrated resolution.
|
||||
Here the presence of :math:`w` is explained by the use of homography coordinate system (and :math:`w=Z`). The unknown parameters are :math:`f_x` and :math:`f_y` (camera focal lengths) and :math:`(c_x, c_y)` which are the optical centers expressed in pixels coordinates. If for both axes a common focal length is used with a given :math:`a` aspect ratio (usually 1), then :math:`f_y=f_x*a` and in the upper formula we will have a single focal length :math:`f`. The matrix containing these four parameters is referred to as the *camera matrix*. While the distortion coefficients are the same regardless of the camera resolutions used, these should be scaled along with the current resolution from the calibrated resolution.
|
||||
|
||||
The process of determining these two matrices is the calibration. Calculating these parameters is done by some basic geometrical equations. The equations used depend on the calibrating objects used. Currently OpenCV supports three types of object for calibration:
|
||||
The process of determining these two matrices is the calibration. Calculation of these parameters is done through basic geometrical equations. The equations used depend on the chosen calibrating objects. Currently OpenCV supports three types of objects for calibration:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
@ -46,7 +46,7 @@ The process of determining these two matrices is the calibration. Calculating th
|
||||
+ Symmetrical circle pattern
|
||||
+ Asymmetrical circle pattern
|
||||
|
||||
Basically, you need to take snapshots of these patterns with your camera and let OpenCV find them. Each found pattern equals in a new equation. To solve the equation you need at least a predetermined number of pattern snapshots to form a well-posed equation system. This number is higher for the chessboard pattern and less for the circle ones. For example, in theory the chessboard one requires at least two. However, in practice we have a good amount of noise present in our input images, so for good results you will probably want at least 10 good snapshots of the input pattern in different position.
|
||||
Basically, you need to take snapshots of these patterns with your camera and let OpenCV find them. Each found pattern results in a new equation. To solve the equation you need at least a predetermined number of pattern snapshots to form a well-posed equation system. This number is higher for the chessboard pattern and less for the circle ones. For example, in theory the chessboard pattern requires at least two snapshots. However, in practice we have a good amount of noise present in our input images, so for good results you will probably need at least 10 good snapshots of the input pattern in different positions.
|
||||
|
||||
Goal
|
||||
====
|
||||
@ -55,19 +55,19 @@ The sample application will:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
+ Determinate the distortion matrix
|
||||
+ Determinate the camera matrix
|
||||
+ Input from Camera, Video and Image file list
|
||||
+ Configuration from XML/YAML file
|
||||
+ Determine the distortion matrix
|
||||
+ Determine the camera matrix
|
||||
+ Take input from Camera, Video and Image file list
|
||||
+ Read configuration from XML/YAML file
|
||||
+ Save the results into XML/YAML file
|
||||
+ Calculate re-projection error
|
||||
|
||||
Source code
|
||||
===========
|
||||
|
||||
You may also find the source code in the :file:`samples/cpp/tutorial_code/calib3d/camera_calibration/` folder of the OpenCV source library or :download:`download it from here <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp>`. The program has a single argument. The name of its configuration file. If none given it will try to open the one named "default.xml". :download:`Here's a sample configuration file <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml>` in XML format. In the configuration file you may choose to use as input a camera, a video file or an image list. If you opt for the later one, you need to create a configuration file where you enumerate the images to use. Here's :download:`an example of this <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml>`. The important part to remember is that the images needs to be specified using the absolute path or the relative one from your applications working directory. You may find all this in the beforehand mentioned directory.
|
||||
You may also find the source code in the :file:`samples/cpp/tutorial_code/calib3d/camera_calibration/` folder of the OpenCV source library or :download:`download it from here <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp>`. The program has a single argument: the name of its configuration file. If none is given then it will try to open the one named "default.xml". :download:`Here's a sample configuration file <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml>` in XML format. In the configuration file you may choose to use camera as an input, a video file or an image list. If you opt for the last one, you will need to create a configuration file where you enumerate the images to use. Here's :download:`an example of this <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml>`. The important part to remember is that the images need to be specified using the absolute path or the relative one from your application's working directory. You may find all this in the samples directory mentioned above.
|
||||
|
||||
The application starts up with reading the settings from the configuration file. Although, this is an important part of it, it has nothing to do with the subject of this tutorial: *camera calibration*. Therefore, I've chosen to do not post here the code part for that. The technical background on how to do this you can find in the :ref:`fileInputOutputXMLYAML` tutorial.
|
||||
The application starts up with reading the settings from the configuration file. Although, this is an important part of it, it has nothing to do with the subject of this tutorial: *camera calibration*. Therefore, I've chosen not to post the code for that part here. Technical background on how to do this you can find in the :ref:`fileInputOutputXMLYAML` tutorial.
|
||||
|
||||
Explanation
|
||||
===========
|
||||
@ -93,9 +93,9 @@ Explanation
|
||||
return -1;
|
||||
}
|
||||
|
||||
For this I've used simple OpenCV class input operation. After reading the file I've an additional post-process function that checks for the validity of the input. Only if all of them are good will be the *goodInput* variable true.
|
||||
For this I've used simple OpenCV class input operation. After reading the file I've an additional post-processing function that checks validity of the input. Only if all inputs are good then *goodInput* variable will be true.
|
||||
|
||||
#. **Get next input, if it fails or we have enough of them calibrate**. After this we have a big loop where we do the following operations: get the next image from the image list, camera or video file. If this fails or we have enough images we run the calibration process. In case of image we step out of the loop and otherwise the remaining frames will be undistorted (if the option is set) via changing from *DETECTION* mode to *CALIBRATED* one.
|
||||
#. **Get next input, if it fails or we have enough of them - calibrate**. After this we have a big loop where we do the following operations: get the next image from the image list, camera or video file. If this fails or we have enough images then we run the calibration process. In case of image we step out of the loop and otherwise the remaining frames will be undistorted (if the option is set) via changing from *DETECTION* mode to the *CALIBRATED* one.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -125,7 +125,7 @@ Explanation
|
||||
|
||||
For some cameras we may need to flip the input image. Here we do this too.
|
||||
|
||||
#. **Find the pattern in the current input**. The formation of the equations I mentioned above consists of finding the major patterns in the input: in case of the chessboard this is their corners of the squares and for the circles, well, the circles itself. The position of these will form the result and is collected into the *pointBuf* vector.
|
||||
#. **Find the pattern in the current input**. The formation of the equations I mentioned above aims to finding major patterns in the input: in case of the chessboard this are corners of the squares and for the circles, well, the circles themselves. The position of these will form the result which will be written into the *pointBuf* vector.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -146,9 +146,9 @@ Explanation
|
||||
break;
|
||||
}
|
||||
|
||||
Depending on the type of the input pattern you use either the :calib3d:`findChessboardCorners <findchessboardcorners>` or the :calib3d:`findCirclesGrid <findcirclesgrid>` function. For both of them you pass on the current image, the size of the board and you'll get back the positions of the patterns. Furthermore, they return a boolean variable that states if in the input we could find or not the pattern (we only need to take into account images where this is true!).
|
||||
Depending on the type of the input pattern you use either the :calib3d:`findChessboardCorners <findchessboardcorners>` or the :calib3d:`findCirclesGrid <findcirclesgrid>` function. For both of them you pass the current image and the size of the board and you'll get the positions of the patterns. Furthermore, they return a boolean variable which states if the pattern was found in the input (we only need to take into account those images where this is true!).
|
||||
|
||||
Then again in case of cameras we only take camera images after an input delay time passed. This is in order to allow for the user to move the chessboard around and as getting different images. Same images mean same equations, and same equations at the calibration will form an ill-posed problem, so the calibration will fail. For square images the position of the corners are only approximate. We may improve this by calling the :feature2d:`cornerSubPix <cornersubpix>` function. This way will get a better calibration result. After this we add a valid inputs result to the *imagePoints* vector to collect all of the equations into a single container. Finally, for visualization feedback purposes we will draw the found points on the input image with the :calib3d:`findChessboardCorners <drawchessboardcorners>` function.
|
||||
Then again in case of cameras we only take camera images when an input delay time is passed. This is done in order to allow user moving the chessboard around and getting different images. Similar images result in similar equations, and similar equations at the calibration step will form an ill-posed problem, so the calibration will fail. For square images the positions of the corners are only approximate. We may improve this by calling the :feature2d:`cornerSubPix <cornersubpix>` function. It will produce better calibration result. After this we add a valid inputs result to the *imagePoints* vector to collect all of the equations into a single container. Finally, for visualization feedback purposes we will draw the found points on the input image using :calib3d:`findChessboardCorners <drawchessboardcorners>` function.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -175,7 +175,7 @@ Explanation
|
||||
drawChessboardCorners( view, s.boardSize, Mat(pointBuf), found );
|
||||
}
|
||||
|
||||
#. **Show state and result for the user, plus command line control of the application**. The showing part consists of a text output on the live feed, and for video or camera input to show the "capturing" frame we simply bitwise negate the input image.
|
||||
#. **Show state and result to the user, plus command line control of the application**. This part shows text output on the image.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -199,7 +199,7 @@ Explanation
|
||||
if( blinkOutput )
|
||||
bitwise_not(view, view);
|
||||
|
||||
If we only ran the calibration and got the camera matrix plus the distortion coefficients we may just as correct the image with the :imgproc_geometric:`undistort <undistort>` function:
|
||||
If we ran calibration and got camera's matrix with the distortion coefficients we may want to correct the image using :imgproc_geometric:`undistort <undistort>` function:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -212,7 +212,7 @@ Explanation
|
||||
//------------------------------ Show image and check for input commands -------------------
|
||||
imshow("Image View", view);
|
||||
|
||||
Then we wait for an input key and if this is *u* we toggle the distortion removal, if it is *g* we start all over the detection process (or simply start it), and finally for the *ESC* key quit the application:
|
||||
Then we wait for an input key and if this is *u* we toggle the distortion removal, if it is *g* we start again the detection process, and finally for the *ESC* key we quit the application:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -229,7 +229,7 @@ Explanation
|
||||
imagePoints.clear();
|
||||
}
|
||||
|
||||
#. **Show the distortion removal for the images too**. When you work with an image list it is not possible to remove the distortion inside the loop. Therefore, you must append this after the loop. Taking advantage of this now I'll expand the :imgproc_geometric:`undistort <undistort>` function, which is in fact first a call of the :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` to find out the transformation matrices and then doing the transformation with the :imgproc_geometric:`remap <remap>` function. Because, after a successful calibration the map calculation needs to be done only once, by using this expanded form you may speed up your application:
|
||||
#. **Show the distortion removal for the images too**. When you work with an image list it is not possible to remove the distortion inside the loop. Therefore, you must do this after the loop. Taking advantage of this now I'll expand the :imgproc_geometric:`undistort <undistort>` function, which is in fact first calls :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` to find transformation matrices and then performs transformation using :imgproc_geometric:`remap <remap>` function. Because, after successful calibration map calculation needs to be done only once, by using this expanded form you may speed up your application:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -256,7 +256,7 @@ Explanation
|
||||
The calibration and save
|
||||
========================
|
||||
|
||||
Because the calibration needs to be only once per camera it makes sense to save them after a successful calibration. This way later on you can just load these values into your program. Due to this we first make the calibration, and if it succeeds we save the result into an OpenCV style XML or YAML file, depending on the extension you give in the configuration file.
|
||||
Because the calibration needs to be done only once per camera, it makes sense to save it after a successful calibration. This way later on you can just load these values into your program. Due to this we first make the calibration, and if it succeeds we save the result into an OpenCV style XML or YAML file, depending on the extension you give in the configuration file.
|
||||
|
||||
Therefore in the first function we just split up these two processes. Because we want to save many of the calibration variables we'll create these variables here and pass on both of them to the calibration and saving function. Again, I'll not show the saving part as that has little in common with the calibration. Explore the source file in order to find out how and what:
|
||||
|
||||
@ -280,7 +280,7 @@ Therefore in the first function we just split up these two processes. Because we
|
||||
return ok;
|
||||
}
|
||||
|
||||
We do the calibration with the help of the :calib3d:`calibrateCamera <calibratecamera>` function. This has the following parameters:
|
||||
We do the calibration with the help of the :calib3d:`calibrateCamera <calibratecamera>` function. It has the following parameters:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
@ -318,11 +318,11 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
|
||||
calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern);
|
||||
objectPoints.resize(imagePoints.size(),objectPoints[0]);
|
||||
|
||||
+ The image points. This is a vector of *Point2f* vector that for each input image contains where the important points (corners for chessboard, and center of circles for the circle patterns) were found. We already collected this from what the :calib3d:`findChessboardCorners <findchessboardcorners>` or the :calib3d:`findCirclesGrid <findcirclesgrid>` function returned. We just need to pass it on.
|
||||
+ The image points. This is a vector of *Point2f* vector which for each input image contains coordinates of the important points (corners for chessboard and centers of the circles for the circle pattern). We have already collected this from :calib3d:`findChessboardCorners <findchessboardcorners>` or :calib3d:`findCirclesGrid <findcirclesgrid>` function. We just need to pass it on.
|
||||
|
||||
+ The size of the image acquired from the camera, video file or the images.
|
||||
|
||||
+ The camera matrix. If we used the fix aspect ratio option we need to set the :math:`f_x` to zero:
|
||||
+ The camera matrix. If we used the fixed aspect ratio option we need to set the :math:`f_x` to zero:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -336,16 +336,16 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
|
||||
|
||||
distCoeffs = Mat::zeros(8, 1, CV_64F);
|
||||
|
||||
+ The function will calculate for all the views the rotation and translation vector that transform the object points (given in the model coordinate space) to the image points (given in the world coordinate space). The 7th and 8th parameters are an output vector of matrices containing in the ith position the rotation and translation vector for the ith object point to the ith image point.
|
||||
+ For all the views the function will calculate rotation and translation vectors which transform the object points (given in the model coordinate space) to the image points (given in the world coordinate space). The 7-th and 8-th parameters are the output vector of matrices containing in the i-th position the rotation and translation vector for the i-th object point to the i-th image point.
|
||||
|
||||
+ The final argument is a flag. You need to specify here options like fix the aspect ratio for the focal length, assume zero tangential distortion or to fix the principal point.
|
||||
+ The final argument is the flag. You need to specify here options like fix the aspect ratio for the focal length, assume zero tangential distortion or to fix the principal point.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix,
|
||||
distCoeffs, rvecs, tvecs, s.flag|CV_CALIB_FIX_K4|CV_CALIB_FIX_K5);
|
||||
|
||||
+ The function returns the average re-projection error. This number gives a good estimation of just how exact is the found parameters. This should be as close to zero as possible. Given the intrinsic, distortion, rotation and translation matrices we may calculate the error for one view by using the :calib3d:`projectPoints <projectpoints>` to first transform the object point to image point. Then we calculate the absolute norm between what we got with our transformation and the corner/circle finding algorithm. To find the average error we calculate the arithmetical mean of the errors calculate for all the calibration images.
|
||||
+ The function returns the average re-projection error. This number gives a good estimation of precision of the found parameters. This should be as close to zero as possible. Given the intrinsic, distortion, rotation and translation matrices we may calculate the error for one view by using the :calib3d:`projectPoints <projectpoints>` to first transform the object point to image point. Then we calculate the absolute norm between what we got with our transformation and the corner/circle finding algorithm. To find the average error we calculate the arithmetical mean of the errors calculated for all the calibration images.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@ -378,25 +378,25 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
|
||||
Results
|
||||
=======
|
||||
|
||||
Let there be :download:`this input chessboard pattern <../../../pattern.png>` that has a size of 9 X 6. I've used an AXIS IP camera to create a couple of snapshots of the board and saved it into a VID5 directory. I've put this inside the :file:`images/CameraCalibraation` folder of my working directory and created the following :file:`VID5.XML` file that describes which images to use:
|
||||
Let there be :download:`this input chessboard pattern <../../../pattern.png>` which has a size of 9 X 6. I've used an AXIS IP camera to create a couple of snapshots of the board and saved it into VID5 directory. I've put this inside the :file:`images/CameraCalibration` folder of my working directory and created the following :file:`VID5.XML` file that describes which images to use:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<opencv_storage>
|
||||
<images>
|
||||
images/CameraCalibraation/VID5/xx1.jpg
|
||||
images/CameraCalibraation/VID5/xx2.jpg
|
||||
images/CameraCalibraation/VID5/xx3.jpg
|
||||
images/CameraCalibraation/VID5/xx4.jpg
|
||||
images/CameraCalibraation/VID5/xx5.jpg
|
||||
images/CameraCalibraation/VID5/xx6.jpg
|
||||
images/CameraCalibraation/VID5/xx7.jpg
|
||||
images/CameraCalibraation/VID5/xx8.jpg
|
||||
images/CameraCalibration/VID5/xx1.jpg
|
||||
images/CameraCalibration/VID5/xx2.jpg
|
||||
images/CameraCalibration/VID5/xx3.jpg
|
||||
images/CameraCalibration/VID5/xx4.jpg
|
||||
images/CameraCalibration/VID5/xx5.jpg
|
||||
images/CameraCalibration/VID5/xx6.jpg
|
||||
images/CameraCalibration/VID5/xx7.jpg
|
||||
images/CameraCalibration/VID5/xx8.jpg
|
||||
</images>
|
||||
</opencv_storage>
|
||||
|
||||
Then specified the :file:`images/CameraCalibraation/VID5/VID5.XML` as input in the configuration file. Here's a chessboard pattern found during the runtime of the application:
|
||||
Then passed :file:`images/CameraCalibration/VID5/VID5.XML` as an input in the configuration file. Here's a chessboard pattern found during the runtime of the application:
|
||||
|
||||
.. image:: images/fileListImage.jpg
|
||||
:alt: A found chessboard
|
||||
@ -433,7 +433,7 @@ In both cases in the specified output XML/YAML file you'll find the camera and d
|
||||
-4.1802327176423804e-001 5.0715244063187526e-001 0. 0.
|
||||
-5.7843597214487474e-001</data></Distortion_Coefficients>
|
||||
|
||||
Add these values as constants to your program, call the :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` and the :imgproc_geometric:`remap <remap>` function to remove distortion and enjoy distortion free inputs with cheap and low quality cameras.
|
||||
Add these values as constants to your program, call the :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` and the :imgproc_geometric:`remap <remap>` function to remove distortion and enjoy distortion free inputs for cheap and low quality cameras.
|
||||
|
||||
You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=ViPN810E0SU>`_.
|
||||
|
||||
|
@ -31,6 +31,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
|
@ -28,6 +28,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
|
@ -30,6 +30,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
|
@ -312,9 +312,13 @@ First we set an enviroment variable to make easier our work. This will hold the
|
||||
|
||||
::
|
||||
|
||||
setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc10
|
||||
|
||||
Here the directory is where you have your OpenCV binaries (*extracted* or *built*). You can have different platform (e.g. x64 instead of x86) or compiler type, so substitute appropriate value. Inside this you should have folders like *bin* and *include*. The -m should be added if you wish to make the settings computer wise, instead of user wise.
|
||||
setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc10 (suggested for Visual Studio 2010 - 32 bit Windows)
|
||||
setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc10 (suggested for Visual Studio 2010 - 64 bit Windows)
|
||||
|
||||
setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc11 (suggested for Visual Studio 2012 - 32 bit Windows)
|
||||
setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc11 (suggested for Visual Studio 2012 - 64 bit Windows)
|
||||
|
||||
Here the directory is where you have your OpenCV binaries (*extracted* or *built*). You can have different platform (e.g. x64 instead of x86) or compiler type, so substitute appropriate value. Inside this you should have two folders called *lib* and *bin*. The -m should be added if you wish to make the settings computer wise, instead of user wise.
|
||||
|
||||
If you built static libraries then you are done. Otherwise, you need to add the *bin* folders path to the systems path. This is cause you will use the OpenCV library in form of *\"Dynamic-link libraries\"* (also known as **DLL**). Inside these are stored all the algorithms and information the OpenCV library contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems **PATH** contains a list of folders where DLLs can be found. Add the OpenCV library path to this and the OS will know where to look if he ever needs the OpenCV binaries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (*exe*) for the OS to find it, which is highly unpleasent if you work on many projects. To do this start up again the |PathEditor|_ and add the following new entry (right click in the application to bring up the menu):
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 31 KiB |
@ -52,7 +52,7 @@ Use for example the *OpenCV_Debug* name. Then by selecting the sheet :menuselect
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$(OPENCV_DIR)\include
|
||||
$(OPENCV_DIR)\..\..\include
|
||||
|
||||
.. image:: images/PropertySheetOpenCVInclude.jpg
|
||||
:alt: Add the include dir like this.
|
||||
@ -64,7 +64,7 @@ Next go to the :menuselection:`Linker --> General` and under the *"Additional Li
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$(OPENCV_DIR)\libs
|
||||
$(OPENCV_DIR)\lib
|
||||
|
||||
.. image:: images/PropertySheetOpenCVLib.jpg
|
||||
:alt: Add the library folder like this.
|
||||
|
@ -1,5 +1,8 @@
|
||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && !defined(ANDROID_r4_2_0)
|
||||
# error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
|
||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && \
|
||||
!defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && \
|
||||
!defined(ANDROID_r4_2_0) && !defined(ANDROID_r4_3_0)
|
||||
# error Building camera wrapper for your version of Android is not supported by OpenCV.\
|
||||
You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
|
||||
#endif
|
||||
|
||||
#include <camera/Camera.h>
|
||||
@ -16,17 +19,18 @@
|
||||
//Include SurfaceTexture.h file with the SurfaceTexture class
|
||||
# include <gui/SurfaceTexture.h>
|
||||
# define MAGIC_OPENCV_TEXTURE_ID (0x10)
|
||||
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
|
||||
//TODO: This is either 2.2 or 2.3. Include the headers for ISurface.h access
|
||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
#include <gui/ISurface.h>
|
||||
#include <gui/BufferQueue.h>
|
||||
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
# include <gui/ISurface.h>
|
||||
# include <gui/BufferQueue.h>
|
||||
#elif defined(ANDROID_r4_3_0)
|
||||
# include <gui/IGraphicBufferProducer.h>
|
||||
# include <gui/BufferQueue.h>
|
||||
#else
|
||||
# include <surfaceflinger/ISurface.h>
|
||||
#endif // defined(ANDROID_r4_1_1)
|
||||
#endif // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
//undef logging macro from /system/core/libcutils/loghack.h
|
||||
#ifdef LOGD
|
||||
@ -45,7 +49,6 @@
|
||||
# undef LOGE
|
||||
#endif
|
||||
|
||||
|
||||
// LOGGING
|
||||
#include <android/log.h>
|
||||
#define CAMERA_LOG_TAG "OpenCV_NativeCamera"
|
||||
@ -60,7 +63,7 @@ using namespace android;
|
||||
|
||||
void debugShowFPS();
|
||||
|
||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
class ConsumerListenerStub: public BufferQueue::ConsumerListener
|
||||
{
|
||||
public:
|
||||
@ -73,6 +76,29 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
std::string getProcessName()
|
||||
{
|
||||
std::string result;
|
||||
std::ifstream f;
|
||||
|
||||
f.open("/proc/self/cmdline");
|
||||
if (f.is_open())
|
||||
{
|
||||
std::string fullPath;
|
||||
std::getline(f, fullPath, '\0');
|
||||
if (!fullPath.empty())
|
||||
{
|
||||
int i = fullPath.size()-1;
|
||||
while ((i >= 0) && (fullPath[i] != '/')) i--;
|
||||
result = fullPath.substr(i+1, std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
f.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void debugShowFPS()
|
||||
{
|
||||
static int mFrameCount = 0;
|
||||
@ -280,7 +306,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
,camera_frame_metadata_t*
|
||||
#endif
|
||||
)
|
||||
@ -361,7 +387,9 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
typedef sp<Camera> (*Android22ConnectFuncType)();
|
||||
typedef sp<Camera> (*Android23ConnectFuncType)(int);
|
||||
typedef sp<Camera> (*Android3DConnectFuncType)(int, int);
|
||||
typedef sp<Camera> (*Android43ConnectFuncType)(int, const String16&, int);
|
||||
|
||||
const int ANY_CAMERA_INDEX = -1;
|
||||
const int BACK_CAMERA_INDEX = 99;
|
||||
const int FRONT_CAMERA_INDEX = 98;
|
||||
|
||||
@ -372,14 +400,24 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */
|
||||
};
|
||||
|
||||
// used for Android 4.3
|
||||
enum {
|
||||
USE_CALLING_UID = -1
|
||||
};
|
||||
|
||||
const char Android22ConnectName[] = "_ZN7android6Camera7connectEv";
|
||||
const char Android23ConnectName[] = "_ZN7android6Camera7connectEi";
|
||||
const char Android3DConnectName[] = "_ZN7android6Camera7connectEii";
|
||||
const char Android43ConnectName[] = "_ZN7android6Camera7connectEiRKNS_8String16Ei";
|
||||
|
||||
int localCameraIndex = cameraId;
|
||||
|
||||
if (cameraId == ANY_CAMERA_INDEX)
|
||||
{
|
||||
localCameraIndex = 0;
|
||||
}
|
||||
#if !defined(ANDROID_r2_2_0)
|
||||
if (cameraId == BACK_CAMERA_INDEX)
|
||||
else if (cameraId == BACK_CAMERA_INDEX)
|
||||
{
|
||||
LOGD("Back camera selected");
|
||||
for (int i = 0; i < Camera::getNumberOfCameras(); i++)
|
||||
@ -450,6 +488,12 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
LOGD("Connecting to CameraService v 3D");
|
||||
camera = Android3DConnect(localCameraIndex, CAMERA_SUPPORT_MODE_2D);
|
||||
}
|
||||
else if (Android43ConnectFuncType Android43Connect = (Android43ConnectFuncType)dlsym(CameraHALHandle, Android43ConnectName))
|
||||
{
|
||||
std::string currentProcName = getProcessName();
|
||||
LOGD("Current process name for camera init: %s", currentProcName.c_str());
|
||||
camera = Android43Connect(localCameraIndex, String16(currentProcName.c_str()), USE_CALLING_UID);
|
||||
}
|
||||
else
|
||||
{
|
||||
dlclose(CameraHALHandle);
|
||||
@ -471,7 +515,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
handler->camera = camera;
|
||||
handler->cameraId = localCameraIndex;
|
||||
|
||||
if (prevCameraParameters != 0)
|
||||
if (prevCameraParameters != NULL)
|
||||
{
|
||||
LOGI("initCameraConnect: Setting paramers from previous camera handler");
|
||||
camera->setParameters(prevCameraParameters->flatten());
|
||||
@ -503,11 +547,11 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
const char* available_focus_modes = handler->params.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
|
||||
if (available_focus_modes != 0)
|
||||
{
|
||||
if (strstr(available_focus_modes, "continuous-video") != NULL)
|
||||
{
|
||||
handler->params.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO);
|
||||
if (strstr(available_focus_modes, "continuous-video") != NULL)
|
||||
{
|
||||
handler->params.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO);
|
||||
|
||||
status_t resParams = handler->camera->setParameters(handler->params.flatten());
|
||||
status_t resParams = handler->camera->setParameters(handler->params.flatten());
|
||||
|
||||
if (resParams != 0)
|
||||
{
|
||||
@ -517,8 +561,8 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
{
|
||||
LOGD("initCameraConnect: autofocus is set to mode \"continuous-video\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//check if yuv420sp format available. Set this format as preview format.
|
||||
@ -560,26 +604,25 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
}
|
||||
}
|
||||
|
||||
status_t pdstatus;
|
||||
status_t bufferStatus;
|
||||
#if defined(ANDROID_r2_2_0)
|
||||
pdstatus = camera->setPreviewDisplay(sp<ISurface>(0 /*new DummySurface*/));
|
||||
if (pdstatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewDisplay(0) call; camera migth not work correctly on some devices");
|
||||
bufferStatus = camera->setPreviewDisplay(sp<ISurface>(0 /*new DummySurface*/));
|
||||
if (bufferStatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewDisplay(0) call (status %d); camera might not work correctly on some devices", bufferStatus);
|
||||
#elif defined(ANDROID_r2_3_3)
|
||||
/* Do nothing in case of 2.3 for now */
|
||||
|
||||
#elif defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
|
||||
sp<SurfaceTexture> surfaceTexture = new SurfaceTexture(MAGIC_OPENCV_TEXTURE_ID);
|
||||
pdstatus = camera->setPreviewTexture(surfaceTexture);
|
||||
if (pdstatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
|
||||
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
bufferStatus = camera->setPreviewTexture(surfaceTexture);
|
||||
if (bufferStatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewTexture call (status %d); camera might not work correctly", bufferStatus);
|
||||
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
sp<BufferQueue> bufferQueue = new BufferQueue();
|
||||
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
|
||||
bufferQueue->consumerConnect(queueListener);
|
||||
pdstatus = camera->setPreviewTexture(bufferQueue);
|
||||
if (pdstatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
|
||||
bufferStatus = camera->setPreviewTexture(bufferQueue);
|
||||
if (bufferStatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewTexture call; camera might not work correctly");
|
||||
#endif
|
||||
|
||||
#if (defined(ANDROID_r2_2_0) || defined(ANDROID_r2_3_3) || defined(ANDROID_r3_0_1))
|
||||
@ -595,9 +638,9 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
#endif //!(defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3))
|
||||
|
||||
LOGD("Starting preview");
|
||||
status_t resStart = camera->startPreview();
|
||||
status_t previewStatus = camera->startPreview();
|
||||
|
||||
if (resStart != 0)
|
||||
if (previewStatus != 0)
|
||||
{
|
||||
LOGE("initCameraConnect: startPreview() fails. Closing camera connection...");
|
||||
handler->closeCameraConnect();
|
||||
@ -605,7 +648,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("Preview started successfully");
|
||||
LOGD("Preview started successfully");
|
||||
}
|
||||
|
||||
return handler;
|
||||
@ -620,9 +663,11 @@ void CameraHandler::closeCameraConnect()
|
||||
}
|
||||
|
||||
camera->stopPreview();
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
|
||||
#endif
|
||||
camera->disconnect();
|
||||
camera.clear();
|
||||
|
||||
camera=NULL;
|
||||
// ATTENTION!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// When we set
|
||||
@ -863,14 +908,60 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
|
||||
|
||||
if (*ppcameraHandler == 0)
|
||||
{
|
||||
LOGE("applyProperties: Passed null *ppcameraHandler");
|
||||
LOGE("applyProperties: Passed NULL *ppcameraHandler");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGD("CameraHandler::applyProperties()");
|
||||
CameraHandler* previousCameraHandler=*ppcameraHandler;
|
||||
CameraParameters curCameraParameters(previousCameraHandler->params.flatten());
|
||||
CameraParameters curCameraParameters((*ppcameraHandler)->params.flatten());
|
||||
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
CameraHandler* handler=*ppcameraHandler;
|
||||
|
||||
handler->camera->stopPreview();
|
||||
handler->camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
|
||||
|
||||
status_t reconnectStatus = handler->camera->reconnect();
|
||||
if (reconnectStatus != 0)
|
||||
{
|
||||
LOGE("applyProperties: failed to reconnect camera (status %d)", reconnectStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
handler->camera->setParameters(curCameraParameters.flatten());
|
||||
handler->params.unflatten(curCameraParameters.flatten());
|
||||
|
||||
status_t bufferStatus;
|
||||
# if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
|
||||
sp<SurfaceTexture> surfaceTexture = new SurfaceTexture(MAGIC_OPENCV_TEXTURE_ID);
|
||||
bufferStatus = handler->camera->setPreviewTexture(surfaceTexture);
|
||||
if (bufferStatus != 0)
|
||||
LOGE("applyProperties: failed setPreviewTexture call (status %d); camera might not work correctly", bufferStatus);
|
||||
# elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
|
||||
sp<BufferQueue> bufferQueue = new BufferQueue();
|
||||
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
|
||||
bufferQueue->consumerConnect(queueListener);
|
||||
bufferStatus = handler->camera->setPreviewTexture(bufferQueue);
|
||||
if (bufferStatus != 0)
|
||||
LOGE("applyProperties: failed setPreviewTexture call; camera might not work correctly");
|
||||
# endif
|
||||
|
||||
handler->camera->setPreviewCallbackFlags( CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK | CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK);//with copy
|
||||
|
||||
LOGD("Starting preview");
|
||||
status_t previewStatus = handler->camera->startPreview();
|
||||
|
||||
if (previewStatus != 0)
|
||||
{
|
||||
LOGE("initCameraConnect: startPreview() fails. Closing camera connection...");
|
||||
handler->closeCameraConnect();
|
||||
handler = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("Preview started successfully");
|
||||
}
|
||||
#else
|
||||
CameraHandler* previousCameraHandler=*ppcameraHandler;
|
||||
CameraCallback cameraCallback=previousCameraHandler->cameraCallback;
|
||||
void* userData=previousCameraHandler->userData;
|
||||
int cameraId=previousCameraHandler->cameraId;
|
||||
@ -879,7 +970,6 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
|
||||
previousCameraHandler->closeCameraConnect();
|
||||
LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect");
|
||||
|
||||
|
||||
LOGD("CameraHandler::applyProperties(): before initCameraConnect");
|
||||
CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters);
|
||||
LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler);
|
||||
@ -892,6 +982,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
|
||||
}
|
||||
}
|
||||
(*ppcameraHandler)=handler;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,14 +431,14 @@ void CameraActivity::applyProperties()
|
||||
int CameraActivity::getFrameWidth()
|
||||
{
|
||||
if (frameWidth <= 0)
|
||||
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
|
||||
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
|
||||
return frameWidth;
|
||||
}
|
||||
|
||||
int CameraActivity::getFrameHeight()
|
||||
{
|
||||
if (frameHeight <= 0)
|
||||
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
|
||||
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
|
||||
return frameHeight;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,16 @@ The functions below use the above model to do the following:
|
||||
|
||||
* Estimate the relative position and orientation of the stereo camera "heads" and compute the *rectification* transformation that makes the camera optical axes parallel.
|
||||
|
||||
.. note::
|
||||
|
||||
* A calibration sample for 3 cameras in horizontal position can be found at opencv_source_code/samples/cpp/3calibration.cpp
|
||||
* A calibration sample based on a sequence of images can be found at opencv_source_code/samples/cpp/calibration.cpp
|
||||
* A calibration sample in order to do 3D reconstruction can be found at opencv_source_code/samples/cpp/build3dmodel.cpp
|
||||
* A calibration sample of an artificially generated camera and chessboard patterns can be found at opencv_source_code/samples/cpp/calibration_artificial.cpp
|
||||
* A calibration example on stereo calibration can be found at opencv_source_code/samples/cpp/stereo_calib.cpp
|
||||
* A calibration example on stereo matching can be found at opencv_source_code/samples/cpp/stereo_match.cpp
|
||||
|
||||
* (Python) A camera calibration sample can be found at opencv_source_code/samples/python2/calibrate.py
|
||||
|
||||
calibrateCamera
|
||||
---------------
|
||||
@ -579,7 +588,9 @@ Finds an object pose from 3D-2D point correspondences.
|
||||
|
||||
The function estimates the object pose given a set of object points, their corresponding image projections, as well as the camera matrix and the distortion coefficients.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example of how to use solvePNP for planar augmented reality can be found at opencv_source_code/samples/python2/plane_ar.py
|
||||
|
||||
solvePnPRansac
|
||||
------------------
|
||||
@ -766,6 +777,9 @@ Homography matrix is determined up to a scale. Thus, it is normalized so that
|
||||
:ocv:func:`warpPerspective`,
|
||||
:ocv:func:`perspectiveTransform`
|
||||
|
||||
.. note::
|
||||
|
||||
* A example on calculating a homography for image matching can be found at opencv_source_code/samples/cpp/video_homography.cpp
|
||||
|
||||
estimateAffine3D
|
||||
--------------------
|
||||
@ -1072,6 +1086,9 @@ Class for computing stereo correspondence using the block matching algorithm. ::
|
||||
The class is a C++ wrapper for the associated functions. In particular, :ocv:funcx:`StereoBM::operator()` is the wrapper for
|
||||
:ocv:cfunc:`cvFindStereoCorrespondenceBM`.
|
||||
|
||||
.. Sample code:
|
||||
|
||||
(Ocl) An example for using the stereoBM matching algorithm can be found at opencv_source_code/samples/ocl/stereo_match.cpp
|
||||
|
||||
StereoBM::StereoBM
|
||||
------------------
|
||||
@ -1171,7 +1188,9 @@ The class implements the modified H. Hirschmuller algorithm [HH08]_ that differs
|
||||
|
||||
* Some pre- and post- processing steps from K. Konolige algorithm :ocv:funcx:`StereoBM::operator()` are included, for example: pre-filtering (``CV_STEREO_BM_XSOBEL`` type) and post-filtering (uniqueness check, quadratic interpolation and speckle filtering).
|
||||
|
||||
.. note::
|
||||
|
||||
* (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found at opencv_source_code/samples/python2/stereo_match.py
|
||||
|
||||
StereoSGBM::StereoSGBM
|
||||
--------------------------
|
||||
|
@ -1 +0,0 @@
|
||||
#include "perf_precomp.hpp"
|
@ -1,44 +0,0 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
/* End of file. */
|
@ -42,9 +42,7 @@
|
||||
#ifndef __OPENCV_PRECOMP_H__
|
||||
#define __OPENCV_PRECOMP_H__
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
@ -1 +0,0 @@
|
||||
#include "test_precomp.hpp"
|
@ -3,6 +3,12 @@ FaceRecognizer
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
.. Sample code::
|
||||
|
||||
* An example using the FaceRecognizer class can be found at opencv_source_code/samples/cpp/facerec_demo.cpp
|
||||
|
||||
* (Python) An example using the FaceRecognizer class can be found at opencv_source_code/samples/python2/facerec_demo.py
|
||||
|
||||
FaceRecognizer
|
||||
--------------
|
||||
|
||||
|
@ -9,6 +9,10 @@ FAB-MAP is an approach to appearance-based place recognition. FAB-MAP compares i
|
||||
|
||||
openFABMAP requires training data (e.g. a collection of images from a similar but not identical environment) to construct a visual vocabulary for the visual bag-of-words model, along with a Chow-Liu tree representation of feature likelihood and for use in the Sampled new place method (see below).
|
||||
|
||||
.. note::
|
||||
|
||||
* An example using the openFABMAP package can be found at opencv_source_code/samples/cpp/fabmap_sample.cpp
|
||||
|
||||
of2::FabMap
|
||||
--------------------
|
||||
|
||||
|
@ -63,6 +63,11 @@ The retina can be settled up with various parameters, by default, the retina can
|
||||
void activateContoursProcessing (const bool activate);
|
||||
};
|
||||
|
||||
.. Sample code::
|
||||
|
||||
* An example on retina tone mapping can be found at opencv_source_code/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp
|
||||
* An example on retina tone mapping on video input can be found at opencv_source_code/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp
|
||||
* A complete example illustrating the retina interface can be found at opencv_source_code/samples/cpp/retinaDemo.cpp
|
||||
|
||||
Description
|
||||
+++++++++++
|
||||
|
@ -744,7 +744,7 @@ static void fjac(int /*i*/, int /*j*/, CvMat *point_params, CvMat* cam_params, C
|
||||
CvMat* _mp = cvCreateMat(1, 1, CV_64FC2 ); //projection of the point
|
||||
|
||||
//split camera params into different matrices
|
||||
CvMat _ri, _ti, _k;
|
||||
CvMat _ri, _ti, _k = cvMat(0, 0, CV_64F, NULL); // dummy initialization to fix warning of cl.exe
|
||||
cvGetRows( cam_params, &_ri, 0, 3 );
|
||||
cvGetRows( cam_params, &_ti, 3, 6 );
|
||||
|
||||
|
@ -59,6 +59,7 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
|
||||
dd->set("nOctaveLayers", 5);
|
||||
dd->set("contrastThreshold", 0.04);
|
||||
dd->set("edgeThreshold", 10.7);
|
||||
break;
|
||||
case CvFeatureTrackerParams::SURF:
|
||||
dd = Algorithm::create<Feature2D>("Feature2D.SURF");
|
||||
if( dd.empty() )
|
||||
@ -66,8 +67,10 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
|
||||
dd->set("hessianThreshold", 400);
|
||||
dd->set("nOctaves", 3);
|
||||
dd->set("nOctaveLayers", 4);
|
||||
break;
|
||||
default:
|
||||
CV_Error(CV_StsBadArg, "Unknown feature type");
|
||||
break;
|
||||
}
|
||||
|
||||
matcher = new BFMatcher(NORM_L2);
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include "opencv2/contrib/contrib.hpp"
|
||||
#include <cvconfig.h>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include <windows.h>
|
||||
@ -16,10 +17,22 @@ namespace cv
|
||||
list.clear();
|
||||
std::string path_f = path + "/" + exten;
|
||||
#ifdef WIN32
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE hFind;
|
||||
#ifdef HAVE_WINRT
|
||||
WIN32_FIND_DATAW FindFileData;
|
||||
#else
|
||||
WIN32_FIND_DATAA FindFileData;
|
||||
#endif
|
||||
HANDLE hFind;
|
||||
|
||||
hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData);
|
||||
#ifdef HAVE_WINRT
|
||||
size_t size = mbstowcs(NULL, path_f.c_str(), path_f.size());
|
||||
Ptr<wchar_t> wpath = new wchar_t[size+1];
|
||||
wpath[size] = 0;
|
||||
mbstowcs(wpath, path_f.c_str(), path_f.size());
|
||||
hFind = FindFirstFileExW(wpath, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
|
||||
#else
|
||||
hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData);
|
||||
#endif
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return list;
|
||||
@ -34,13 +47,26 @@ namespace cv
|
||||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_SYSTEM ||
|
||||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_READONLY)
|
||||
{
|
||||
cv::Ptr<char> fname;
|
||||
#ifdef HAVE_WINRT
|
||||
size_t asize = wcstombs(NULL, FindFileData.cFileName, 0);
|
||||
fname = new char[asize+1];
|
||||
fname[asize] = 0;
|
||||
wcstombs(fname, FindFileData.cFileName, asize);
|
||||
#else
|
||||
fname = FindFileData.cFileName;
|
||||
#endif
|
||||
if (addPath)
|
||||
list.push_back(path + "/" + FindFileData.cFileName);
|
||||
list.push_back(path + "/" + std::string(fname));
|
||||
else
|
||||
list.push_back(FindFileData.cFileName);
|
||||
list.push_back(std::string(fname));
|
||||
}
|
||||
}
|
||||
while(FindNextFile(hFind, &FindFileData));
|
||||
#ifdef HAVE_WINRT
|
||||
while(FindNextFileW(hFind, &FindFileData));
|
||||
#else
|
||||
while(FindNextFileA(hFind, &FindFileData));
|
||||
#endif
|
||||
FindClose(hFind);
|
||||
}
|
||||
#else
|
||||
@ -75,10 +101,22 @@ namespace cv
|
||||
std::string path_f = path + "/" + exten;
|
||||
list.clear();
|
||||
#ifdef WIN32
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
#ifdef HAVE_WINRT
|
||||
WIN32_FIND_DATAW FindFileData;
|
||||
#else
|
||||
WIN32_FIND_DATAA FindFileData;
|
||||
#endif
|
||||
HANDLE hFind;
|
||||
|
||||
hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData);
|
||||
#ifdef HAVE_WINRT
|
||||
size_t size = mbstowcs(NULL, path_f.c_str(), path_f.size());
|
||||
Ptr<wchar_t> wpath = new wchar_t[size+1];
|
||||
wpath[size] = 0;
|
||||
mbstowcs(wpath, path_f.c_str(), path_f.size());
|
||||
hFind = FindFirstFileExW(wpath, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
|
||||
#else
|
||||
hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData);
|
||||
#endif
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return list;
|
||||
@ -87,17 +125,37 @@ namespace cv
|
||||
{
|
||||
do
|
||||
{
|
||||
#ifdef HAVE_WINRT
|
||||
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY &&
|
||||
wcscmp(FindFileData.cFileName, L".") != 0 &&
|
||||
wcscmp(FindFileData.cFileName, L"..") != 0)
|
||||
#else
|
||||
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY &&
|
||||
strcmp(FindFileData.cFileName, ".") != 0 &&
|
||||
strcmp(FindFileData.cFileName, "..") != 0)
|
||||
#endif
|
||||
{
|
||||
cv::Ptr<char> fname;
|
||||
#ifdef HAVE_WINRT
|
||||
size_t asize = wcstombs(NULL, FindFileData.cFileName, 0);
|
||||
fname = new char[asize+1];
|
||||
fname[asize] = 0;
|
||||
wcstombs(fname, FindFileData.cFileName, asize);
|
||||
#else
|
||||
fname = FindFileData.cFileName;
|
||||
#endif
|
||||
|
||||
if (addPath)
|
||||
list.push_back(path + "/" + FindFileData.cFileName);
|
||||
list.push_back(path + "/" + std::string(fname));
|
||||
else
|
||||
list.push_back(FindFileData.cFileName);
|
||||
list.push_back(std::string(fname));
|
||||
}
|
||||
}
|
||||
while(FindNextFile(hFind, &FindFileData));
|
||||
#ifdef HAVE_WINRT
|
||||
while(FindNextFileW(hFind, &FindFileData));
|
||||
#else
|
||||
while(FindNextFileA(hFind, &FindFileData));
|
||||
#endif
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
/* End of file. */
|
@ -43,9 +43,7 @@
|
||||
#ifndef __OPENCV_PRECOMP_H__
|
||||
#define __OPENCV_PRECOMP_H__
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
||||
#include "opencv2/contrib/contrib.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
|
@ -1 +0,0 @@
|
||||
#include "test_precomp.hpp"
|
@ -2,6 +2,10 @@ set(the_description "The Core Functionality")
|
||||
ocv_add_module(core ${ZLIB_LIBRARIES})
|
||||
ocv_module_include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if (HAVE_WINRT)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"")
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA)
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
|
||||
|
@ -803,6 +803,9 @@ Finally, there are STL-style iterators that are smart enough to skip gaps betwee
|
||||
|
||||
The matrix iterators are random-access iterators, so they can be passed to any STL algorithm, including ``std::sort()`` .
|
||||
|
||||
.. note::
|
||||
|
||||
* An example demonstrating the serial out capabilities of cv::Mat can be found at opencv_source_code/samples/cpp/cout_mat.cpp
|
||||
|
||||
.. _MatrixExpressions:
|
||||
|
||||
|
@ -66,6 +66,12 @@ Basically, you can use only the core of the function, set the number of
|
||||
attempts to 1, initialize labels each time using a custom algorithm, pass them with the
|
||||
( ``flags`` = ``KMEANS_USE_INITIAL_LABELS`` ) flag, and then choose the best (most-compact) clustering.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example on K-means clustering can be found at opencv_source_code/samples/cpp/kmeans.cpp
|
||||
|
||||
* (Python) An example on K-means clustering can be found at opencv_source_code/samples/python2/kmeans.py
|
||||
|
||||
partition
|
||||
-------------
|
||||
Splits an element set into equivalency classes.
|
||||
|
@ -14,4 +14,5 @@ core. The Core Functionality
|
||||
old_xml_yaml_persistence
|
||||
clustering
|
||||
utility_and_system_functions_and_macros
|
||||
opengl_interop
|
||||
|
||||
|
@ -26,6 +26,10 @@ If a drawn figure is partially or completely outside the image, the drawing func
|
||||
|
||||
.. note:: The functions do not support alpha-transparency when the target image is 4-channel. In this case, the ``color[3]`` is simply copied to the repainted pixels. Thus, if you want to paint semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example on using variate drawing functions like line, rectangle, ... can be found at opencv_source_code/samples/cpp/drawing.cpp
|
||||
|
||||
circle
|
||||
----------
|
||||
Draws a circle.
|
||||
|
543
modules/core/doc/opengl_interop.rst
Normal file
543
modules/core/doc/opengl_interop.rst
Normal file
@ -0,0 +1,543 @@
|
||||
OpenGL interoperability
|
||||
=======================
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
|
||||
|
||||
General Information
|
||||
-------------------
|
||||
This section describes OpenGL interoperability.
|
||||
|
||||
To enable OpenGL support, configure OpenCV using ``CMake`` with ``WITH_OPENGL=ON`` .
|
||||
Currently OpenGL is supported only with WIN32, GTK and Qt backends on Windows and Linux (MacOS and Android are not supported).
|
||||
For GTK backend ``gtkglext-1.0`` library is required.
|
||||
|
||||
To use OpenGL functionality you should first create OpenGL context (window or frame buffer).
|
||||
You can do this with :ocv:func:`namedWindow` function or with other OpenGL toolkit (GLUT, for example).
|
||||
|
||||
|
||||
|
||||
ogl::Buffer
|
||||
-----------
|
||||
Smart pointer for OpenGL buffer object with reference counting.
|
||||
|
||||
.. ocv:class:: ogl::Buffer
|
||||
|
||||
Buffer Objects are OpenGL objects that store an array of unformatted memory allocated by the OpenGL context.
|
||||
These can be used to store vertex data, pixel data retrieved from images or the framebuffer, and a variety of other things.
|
||||
|
||||
``ogl::Buffer`` has interface similar with :ocv:class:`Mat` interface and represents 2D array memory.
|
||||
|
||||
``ogl::Buffer`` supports memory transfers between host and device and also can be mapped to CUDA memory.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::Target
|
||||
-------------------
|
||||
The target defines how you intend to use the buffer object.
|
||||
|
||||
.. ocv:enum:: ogl::Buffer::Target
|
||||
|
||||
.. ocv:emember:: ARRAY_BUFFER
|
||||
|
||||
The buffer will be used as a source for vertex data.
|
||||
|
||||
.. ocv:emember:: ELEMENT_ARRAY_BUFFER
|
||||
|
||||
The buffer will be used for indices (in ``glDrawElements`` or :ocv:func:`ogl::render`, for example).
|
||||
|
||||
.. ocv:emember:: PIXEL_PACK_BUFFER
|
||||
|
||||
The buffer will be used for reading from OpenGL textures.
|
||||
|
||||
.. ocv:emember:: PIXEL_UNPACK_BUFFER
|
||||
|
||||
The buffer will be used for writing to OpenGL textures.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::Buffer
|
||||
-------------------
|
||||
The constructors.
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer()
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Buffer::Buffer(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
:param arows: Number of rows in a 2D array.
|
||||
|
||||
:param acols: Number of columns in a 2D array.
|
||||
|
||||
:param asize: 2D array size.
|
||||
|
||||
:param atype: Array type ( ``CV_8UC1, ..., CV_64FC4`` ). See :ocv:class:`Mat` for details.
|
||||
|
||||
:param abufId: Buffer object name.
|
||||
|
||||
:param arr: Input array (host or device memory, it can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` or ``std::vector`` ).
|
||||
|
||||
:param target: Buffer usage. See :ocv:enum:`ogl::Buffer::Target` .
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
Creates empty ``ogl::Buffer`` object, creates ``ogl::Buffer`` object from existed buffer ( ``abufId`` parameter),
|
||||
allocates memory for ``ogl::Buffer`` object or copies from host/device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::create
|
||||
-------------------
|
||||
Allocates memory for ``ogl::Buffer`` object.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::create(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::create(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
:param arows: Number of rows in a 2D array.
|
||||
|
||||
:param acols: Number of columns in a 2D array.
|
||||
|
||||
:param asize: 2D array size.
|
||||
|
||||
:param atype: Array type ( ``CV_8UC1, ..., CV_64FC4`` ). See :ocv:class:`Mat` for details.
|
||||
|
||||
:param target: Buffer usage. See :ocv:enum:`ogl::Buffer::Target` .
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::release
|
||||
--------------------
|
||||
Decrements the reference counter and destroys the buffer object if needed.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::release()
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::setAutoRelease
|
||||
---------------------------
|
||||
Sets auto release mode.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::setAutoRelease(bool flag)
|
||||
|
||||
:param flag: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
The lifetime of the OpenGL object is tied to the lifetime of the context.
|
||||
If OpenGL context was bound to a window it could be released at any time (user can close a window).
|
||||
If object's destructor is called after destruction of the context it will cause an error.
|
||||
Thus ``ogl::Buffer`` doesn't destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context).
|
||||
This function can force ``ogl::Buffer`` destructor to destroy OpenGL object.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::copyFrom
|
||||
---------------------
|
||||
Copies from host/device memory to OpenGL buffer.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false)
|
||||
|
||||
:param arr: Input array (host or device memory, it can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` or ``std::vector`` ).
|
||||
|
||||
:param target: Buffer usage. See :ocv:enum:`ogl::Buffer::Target` .
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::copyTo
|
||||
-------------------
|
||||
Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::copyTo(OutputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false) const
|
||||
|
||||
:param arr: Destination array (host or device memory, can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` , ``std::vector`` or ``ogl::Buffer`` ).
|
||||
|
||||
:param target: Buffer usage for destination buffer (if ``arr`` is OpenGL buffer).
|
||||
|
||||
:param autoRelease: Auto release mode for destination buffer (if ``arr`` is OpenGL buffer).
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::clone
|
||||
------------------
|
||||
Creates a full copy of the buffer object and the underlying data.
|
||||
|
||||
.. ocv:function:: Buffer ogl::Buffer::clone(Target target = ARRAY_BUFFER, bool autoRelease = false) const
|
||||
|
||||
:param target: Buffer usage for destination buffer.
|
||||
|
||||
:param autoRelease: Auto release mode for destination buffer.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::bind
|
||||
-----------------
|
||||
Binds OpenGL buffer to the specified buffer binding point.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::bind(Target target) const
|
||||
|
||||
:param target: Binding point. See :ocv:enum:`ogl::Buffer::Target` .
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::unbind
|
||||
-------------------
|
||||
Unbind any buffers from the specified binding point.
|
||||
|
||||
.. ocv:function:: static void ogl::Buffer::unbind(Target target)
|
||||
|
||||
:param target: Binding point. See :ocv:enum:`ogl::Buffer::Target` .
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::mapHost
|
||||
--------------------
|
||||
Maps OpenGL buffer to host memory.
|
||||
|
||||
.. ocv:function:: Mat ogl::Buffer::mapHost(Access access)
|
||||
|
||||
:param access: Access policy, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store. The symbolic constant must be ``ogl::Buffer::READ_ONLY`` , ``ogl::Buffer::WRITE_ONLY`` or ``ogl::Buffer::READ_WRITE`` .
|
||||
|
||||
``mapHost`` maps to the client's address space the entire data store of the buffer object.
|
||||
The data can then be directly read and/or written relative to the returned pointer, depending on the specified ``access`` policy.
|
||||
|
||||
A mapped data store must be unmapped with :ocv:func:`ogl::Buffer::unmapHost` before its buffer object is used.
|
||||
|
||||
This operation can lead to memory transfers between host and device.
|
||||
|
||||
Only one buffer object can be mapped at a time.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::unmapHost
|
||||
----------------------
|
||||
Unmaps OpenGL buffer.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::unmapHost()
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::mapDevice
|
||||
----------------------
|
||||
Maps OpenGL buffer to CUDA device memory.
|
||||
|
||||
.. ocv:function:: gpu::GpuMat ogl::Buffer::mapDevice()
|
||||
|
||||
This operatation doesn't copy data.
|
||||
Several buffer objects can be mapped to CUDA memory at a time.
|
||||
|
||||
A mapped data store must be unmapped with :ocv:func:`ogl::Buffer::unmapDevice` before its buffer object is used.
|
||||
|
||||
|
||||
|
||||
ogl::Buffer::unmapDevice
|
||||
------------------------
|
||||
Unmaps OpenGL buffer.
|
||||
|
||||
.. ocv:function:: void ogl::Buffer::unmapDevice()
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D
|
||||
--------------
|
||||
Smart pointer for OpenGL 2D texture memory with reference counting.
|
||||
|
||||
.. ocv:class:: ogl::Texture2D
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::Format
|
||||
----------------------
|
||||
An Image Format describes the way that the images in Textures store their data.
|
||||
|
||||
.. ocv:enum:: ogl::Texture2D::Format
|
||||
|
||||
.. ocv:emember:: NONE
|
||||
.. ocv:emember:: DEPTH_COMPONENT
|
||||
.. ocv:emember:: RGB
|
||||
.. ocv:emember:: RGBA
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::Texture2D
|
||||
-------------------------
|
||||
The constructors.
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D()
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D(int arows, int acols, Format aformat, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D(Size asize, Format aformat, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: ogl::Texture2D::Texture2D(InputArray arr, bool autoRelease = false)
|
||||
|
||||
:param arows: Number of rows.
|
||||
|
||||
:param acols: Number of columns.
|
||||
|
||||
:param asize: 2D array size.
|
||||
|
||||
:param aformat: Image format. See :ocv:enum:`ogl::Texture2D::Format` .
|
||||
|
||||
:param arr: Input array (host or device memory, it can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` or :ocv:class:`ogl::Buffer` ).
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
Creates empty ``ogl::Texture2D`` object, allocates memory for ``ogl::Texture2D`` object or copies from host/device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::create
|
||||
----------------------
|
||||
Allocates memory for ``ogl::Texture2D`` object.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::create(int arows, int acols, Format aformat, bool autoRelease = false)
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::create(Size asize, Format aformat, bool autoRelease = false)
|
||||
|
||||
:param arows: Number of rows.
|
||||
|
||||
:param acols: Number of columns.
|
||||
|
||||
:param asize: 2D array size.
|
||||
|
||||
:param aformat: Image format. See :ocv:enum:`ogl::Texture2D::Format` .
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::release
|
||||
-----------------------
|
||||
Decrements the reference counter and destroys the texture object if needed.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::release()
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::setAutoRelease
|
||||
------------------------------
|
||||
Sets auto release mode.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::setAutoRelease(bool flag)
|
||||
|
||||
:param flag: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
The lifetime of the OpenGL object is tied to the lifetime of the context.
|
||||
If OpenGL context was bound to a window it could be released at any time (user can close a window).
|
||||
If object's destructor is called after destruction of the context it will cause an error.
|
||||
Thus ``ogl::Texture2D`` doesn't destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context).
|
||||
This function can force ``ogl::Texture2D`` destructor to destroy OpenGL object.
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::copyFrom
|
||||
------------------------
|
||||
Copies from host/device memory to OpenGL texture.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease = false)
|
||||
|
||||
:param arr: Input array (host or device memory, it can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` or :ocv:class:`ogl::Buffer` ).
|
||||
|
||||
:param autoRelease: Auto release mode (if true, release will be called in object's destructor).
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::copyTo
|
||||
----------------------
|
||||
Copies from OpenGL texture to host/device memory or another OpenGL texture object.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::copyTo(OutputArray arr, int ddepth = CV_32F, bool autoRelease = false) const
|
||||
|
||||
:param arr: Destination array (host or device memory, can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` , :ocv:class:`ogl::Buffer` or ``ogl::Texture2D`` ).
|
||||
|
||||
:param ddepth: Destination depth.
|
||||
|
||||
:param autoRelease: Auto release mode for destination buffer (if ``arr`` is OpenGL buffer or texture).
|
||||
|
||||
|
||||
|
||||
ogl::Texture2D::bind
|
||||
--------------------
|
||||
Binds texture to current active texture unit for ``GL_TEXTURE_2D`` target.
|
||||
|
||||
.. ocv:function:: void ogl::Texture2D::bind() const
|
||||
|
||||
|
||||
|
||||
ogl::Arrays
|
||||
-----------
|
||||
Wrapper for OpenGL Client-Side Vertex arrays.
|
||||
|
||||
.. ocv:class:: ogl::Arrays
|
||||
|
||||
``ogl::Arrays`` stores vertex data in :ocv:class:`ogl::Buffer` objects.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::setVertexArray
|
||||
---------------------------
|
||||
Sets an array of vertex coordinates.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::setVertexArray(InputArray vertex)
|
||||
|
||||
:param vertex: array with vertex coordinates, can be both host and device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::resetVertexArray
|
||||
-----------------------------
|
||||
Resets vertex coordinates.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::resetVertexArray()
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::setColorArray
|
||||
--------------------------
|
||||
Sets an array of vertex colors.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::setColorArray(InputArray color)
|
||||
|
||||
:param color: array with vertex colors, can be both host and device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::resetColorArray
|
||||
----------------------------
|
||||
Resets vertex colors.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::resetColorArray()
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::setNormalArray
|
||||
---------------------------
|
||||
Sets an array of vertex normals.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::setNormalArray(InputArray normal)
|
||||
|
||||
:param normal: array with vertex normals, can be both host and device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::resetNormalArray
|
||||
-----------------------------
|
||||
Resets vertex normals.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::resetNormalArray()
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::setTexCoordArray
|
||||
-----------------------------
|
||||
Sets an array of vertex texture coordinates.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::setTexCoordArray(InputArray texCoord)
|
||||
|
||||
:param texCoord: array with vertex texture coordinates, can be both host and device memory.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::resetTexCoordArray
|
||||
-------------------------------
|
||||
Resets vertex texture coordinates.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::resetTexCoordArray()
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::release
|
||||
--------------------
|
||||
Releases all inner buffers.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::release()
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::setAutoRelease
|
||||
---------------------------
|
||||
Sets auto release mode all inner buffers.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::setAutoRelease(bool flag)
|
||||
|
||||
:param flag: Auto release mode.
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::bind
|
||||
-----------------
|
||||
Binds all vertex arrays.
|
||||
|
||||
.. ocv:function:: void ogl::Arrays::bind() const
|
||||
|
||||
|
||||
|
||||
ogl::Arrays::size
|
||||
-----------------
|
||||
Returns the vertex count.
|
||||
|
||||
.. ocv:function:: int ogl::Arrays::size() const
|
||||
|
||||
|
||||
|
||||
ogl::render
|
||||
-----------
|
||||
Render OpenGL texture or primitives.
|
||||
|
||||
.. ocv:function:: void ogl::render(const Texture2D& tex, Rect_<double> wndRect = Rect_<double>(0.0, 0.0, 1.0, 1.0), Rect_<double> texRect = Rect_<double>(0.0, 0.0, 1.0, 1.0))
|
||||
|
||||
.. ocv:function:: void ogl::render(const Arrays& arr, int mode = POINTS, Scalar color = Scalar::all(255))
|
||||
|
||||
.. ocv:function:: void ogl::render(const Arrays& arr, InputArray indices, int mode = POINTS, Scalar color = Scalar::all(255))
|
||||
|
||||
:param tex: Texture to draw.
|
||||
|
||||
:param wndRect: Region of window, where to draw a texture (normalized coordinates).
|
||||
|
||||
:param texRect: Region of texture to draw (normalized coordinates).
|
||||
|
||||
:param arr: Array of privitives vertices.
|
||||
|
||||
:param indices: Array of vertices indices (host or device memory).
|
||||
|
||||
:param mode: Render mode. Available options:
|
||||
|
||||
* **POINTS**
|
||||
* **LINES**
|
||||
* **LINE_LOOP**
|
||||
* **LINE_STRIP**
|
||||
* **TRIANGLES**
|
||||
* **TRIANGLE_STRIP**
|
||||
* **TRIANGLE_FAN**
|
||||
* **QUADS**
|
||||
* **QUAD_STRIP**
|
||||
* **POLYGON**
|
||||
|
||||
:param color: Color for all vertices. Will be used if ``arr`` doesn't contain color array.
|
||||
|
||||
|
||||
|
||||
gpu::setGlDevice
|
||||
----------------
|
||||
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
|
||||
|
||||
.. ocv:function:: void gpu::setGlDevice( int device = 0 )
|
||||
|
||||
:param device: System index of a GPU device starting with 0.
|
||||
|
||||
This function should be explicitly called after OpenGL context creation and before any CUDA calls.
|
@ -532,7 +532,7 @@ Performs the per-element comparison of two arrays or an array and scalar value.
|
||||
|
||||
:param value: scalar value.
|
||||
|
||||
:param dst: output array that has the same size as the input arrays and type= ``CV_8UC1`` .
|
||||
:param dst: output array that has the same size and type as the input arrays.
|
||||
|
||||
:param cmpop: a flag, that specifies correspondence between the arrays:
|
||||
|
||||
@ -997,6 +997,12 @@ All of the above improvements have been implemented in :ocv:func:`matchTemplate`
|
||||
|
||||
.. seealso:: :ocv:func:`dct` , :ocv:func:`getOptimalDFTSize` , :ocv:func:`mulSpectrums`, :ocv:func:`filter2D` , :ocv:func:`matchTemplate` , :ocv:func:`flip` , :ocv:func:`cartToPolar` , :ocv:func:`magnitude` , :ocv:func:`phase`
|
||||
|
||||
.. note::
|
||||
|
||||
* An example using the discrete fourier transform can be found at opencv_source_code/samples/cpp/dft.cpp
|
||||
|
||||
* (Python) An example using the dft functionality to perform Wiener deconvolution can be found at opencv_source/samples/python2/deconvolution.py
|
||||
* (Python) An example rearranging the quadrants of a Fourier image can be found at opencv_source/samples/python2/dft.py
|
||||
|
||||
|
||||
divide
|
||||
@ -2262,7 +2268,9 @@ The sample below is the function that takes two matrices. The first function sto
|
||||
:ocv:func:`dft`,
|
||||
:ocv:func:`dct`
|
||||
|
||||
.. note::
|
||||
|
||||
* An example using PCA for dimensionality reduction while maintaining an amount of variance can be found at opencv_source_code/samples/cpp/pca.cpp
|
||||
|
||||
PCA::PCA
|
||||
--------
|
||||
|
@ -11,7 +11,7 @@ You can store and then restore various OpenCV data structures to/from XML (http:
|
||||
|
||||
Use the following procedure to write something to XML or YAML:
|
||||
#. Create new :ocv:class:`FileStorage` and open it for writing. It can be done with a single call to :ocv:func:`FileStorage::FileStorage` constructor that takes a filename, or you can use the default constructor and then call :ocv:func:`FileStorage::open`. Format of the file (XML or YAML) is determined from the filename extension (".xml" and ".yml"/".yaml", respectively)
|
||||
#. Write all the data you want using the streaming operator ``>>``, just like in the case of STL streams.
|
||||
#. Write all the data you want using the streaming operator ``<<``, just like in the case of STL streams.
|
||||
#. Close the file using :ocv:func:`FileStorage::release`. ``FileStorage`` destructor also closes the file.
|
||||
|
||||
Here is an example: ::
|
||||
@ -91,6 +91,10 @@ Several things can be noted by looking at the sample code and the output:
|
||||
*
|
||||
In YAML (but not XML), mappings and sequences can be written in a compact Python-like inline form. In the sample above matrix elements, as well as each feature, including its lbp value, is stored in such inline form. To store a mapping/sequence in a compact form, put ":" after the opening character, e.g. use **"{:"** instead of **"{"** and **"[:"** instead of **"["**. When the data is written to XML, those extra ":" are ignored.
|
||||
|
||||
.. note::
|
||||
|
||||
* A complete example using the FileStorage interface can be found at opencv_source_code/samples/cpp/filestorage.cpp
|
||||
|
||||
|
||||
Reading data from a file storage.
|
||||
---------------------------------
|
||||
|
@ -136,7 +136,13 @@ CV_INLINE IppiSize ippiSize(int width, int height)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __ARM_NEON__
|
||||
|
||||
#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
|
||||
# include <Intrin.h>
|
||||
# include "arm_neon.h"
|
||||
# define CV_NEON 1
|
||||
# define CPU_HAS_NEON_FEATURE (true)
|
||||
#elif defined(__ARM_NEON__)
|
||||
# include <arm_neon.h>
|
||||
# define CV_NEON 1
|
||||
# define CPU_HAS_NEON_FEATURE (true)
|
||||
@ -340,25 +346,6 @@ namespace cv
|
||||
* Common declarations *
|
||||
\****************************************************************************************/
|
||||
|
||||
/* get alloca declaration */
|
||||
#ifdef __GNUC__
|
||||
# undef alloca
|
||||
# define alloca __builtin_alloca
|
||||
# define CV_HAVE_ALLOCA 1
|
||||
#elif defined WIN32 || defined _WIN32 || \
|
||||
defined WINCE || defined _MSC_VER || defined __BORLANDC__
|
||||
# include <malloc.h>
|
||||
# define CV_HAVE_ALLOCA 1
|
||||
#elif defined HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# define CV_HAVE_ALLOCA 1
|
||||
#elif defined HAVE_ALLOCA
|
||||
# include <stdlib.h>
|
||||
# define CV_HAVE_ALLOCA 1
|
||||
#else
|
||||
# undef CV_HAVE_ALLOCA
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
|
||||
#elif defined _MSC_VER
|
||||
@ -367,11 +354,6 @@ namespace cv
|
||||
# define CV_DECL_ALIGNED(x)
|
||||
#endif
|
||||
|
||||
#if CV_HAVE_ALLOCA
|
||||
/* ! DO NOT make it an inline function */
|
||||
# define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
|
||||
#endif
|
||||
|
||||
#ifndef CV_IMPL
|
||||
# define CV_IMPL CV_EXTERN_C
|
||||
#endif
|
||||
|
@ -137,7 +137,7 @@
|
||||
#ifndef CV_INLINE
|
||||
# if defined __cplusplus
|
||||
# define CV_INLINE inline
|
||||
# elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__
|
||||
# elif defined _MSC_VER
|
||||
# define CV_INLINE __inline
|
||||
# else
|
||||
# define CV_INLINE static
|
||||
@ -317,7 +317,7 @@ CV_INLINE int cvRound( double value )
|
||||
return t;
|
||||
#elif defined _MSC_VER && defined _M_ARM && defined HAVE_TEGRA_OPTIMIZATION
|
||||
TEGRA_ROUND(value);
|
||||
#elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
|
||||
#elif defined CV_ICC || defined __GNUC__
|
||||
# ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
TEGRA_ROUND(value);
|
||||
# else
|
||||
|
@ -50,7 +50,7 @@
|
||||
#define CV_VERSION_EPOCH 2
|
||||
#define CV_VERSION_MAJOR 4
|
||||
#define CV_VERSION_MINOR 6
|
||||
#define CV_VERSION_REVISION 0
|
||||
#define CV_VERSION_REVISION 1
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
@ -1 +0,0 @@
|
||||
#include "perf_precomp.hpp"
|
@ -33,7 +33,7 @@ PERF_TEST_P(Size_MatType, mean, TYPICAL_MATS)
|
||||
|
||||
TEST_CYCLE() s = mean(src);
|
||||
|
||||
SANITY_CHECK(s, 1e-6);
|
||||
SANITY_CHECK(s, 1e-5);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType, mean_mask, TYPICAL_MATS)
|
||||
@ -49,7 +49,7 @@ PERF_TEST_P(Size_MatType, mean_mask, TYPICAL_MATS)
|
||||
|
||||
TEST_CYCLE() s = mean(src, mask);
|
||||
|
||||
SANITY_CHECK(s, 1e-6);
|
||||
SANITY_CHECK(s, 5e-5);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType, meanStdDev, TYPICAL_MATS)
|
||||
|
@ -94,9 +94,20 @@ void fastFree(void* ptr)
|
||||
#define STAT(stmt)
|
||||
|
||||
#ifdef WIN32
|
||||
#if (_WIN32_WINNT >= 0x0602)
|
||||
#include <synchapi.h>
|
||||
#endif
|
||||
|
||||
struct CriticalSection
|
||||
{
|
||||
CriticalSection() { InitializeCriticalSection(&cs); }
|
||||
CriticalSection()
|
||||
{
|
||||
#if (_WIN32_WINNT >= 0x0600)
|
||||
InitializeCriticalSectionEx(&cs, 1000, 0);
|
||||
#else
|
||||
InitializeCriticalSection(&cs);
|
||||
#endif
|
||||
}
|
||||
~CriticalSection() { DeleteCriticalSection(&cs); }
|
||||
void lock() { EnterCriticalSection(&cs); }
|
||||
void unlock() { LeaveCriticalSection(&cs); }
|
||||
|
@ -886,11 +886,13 @@ void ellipse2Poly( Point center, Size axes, int angle,
|
||||
Point pt;
|
||||
pt.x = cvRound( cx + x * alpha - y * beta );
|
||||
pt.y = cvRound( cy + x * beta + y * alpha );
|
||||
if( pt != prevPt )
|
||||
if( pt != prevPt ){
|
||||
pts.push_back(pt);
|
||||
prevPt = pt;
|
||||
}
|
||||
}
|
||||
|
||||
if( pts.size() < 2 )
|
||||
if( pts.size() == 1 )
|
||||
pts.push_back(pts[0]);
|
||||
}
|
||||
|
||||
|
@ -1458,6 +1458,10 @@ static void CCSIDFT_64f( const double* src, double* dst, int n, int nf, int* fac
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
typedef IppStatus (CV_STDCALL* IppDFTGetSizeFunc)(int, int, IppHintAlgorithm, int*, int*, int*);
|
||||
typedef IppStatus (CV_STDCALL* IppDFTInitFunc)(int, int, IppHintAlgorithm, void*, uchar*);
|
||||
#endif
|
||||
|
||||
void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
{
|
||||
@ -1483,7 +1487,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
int factors[34];
|
||||
bool inplace_transform = false;
|
||||
#ifdef HAVE_IPP
|
||||
void *spec_r = 0, *spec_c = 0;
|
||||
AutoBuffer<uchar> ippbuf;
|
||||
int ipp_norm_flag = !(flags & DFT_SCALE) ? 8 : inv ? 2 : 1;
|
||||
#endif
|
||||
|
||||
@ -1543,52 +1547,51 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
|
||||
spec = 0;
|
||||
#ifdef HAVE_IPP
|
||||
if( len*count >= 64 ) // use IPP DFT if available
|
||||
if(
|
||||
#if IPP_VERSION_MAJOR >= 7
|
||||
depth == CV_32F && // IPP 7.x and 8.0 have bug somewhere in double-precision DFT
|
||||
#endif
|
||||
len*count >= 64 ) // use IPP DFT if available
|
||||
{
|
||||
int ipp_sz = 0;
|
||||
int specsize=0, initsize=0, worksize=0;
|
||||
IppDFTGetSizeFunc getSizeFunc = 0;
|
||||
IppDFTInitFunc initFunc = 0;
|
||||
|
||||
if( real_transform && stage == 0 )
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
if( spec_r )
|
||||
IPPI_CALL( ippsDFTFree_R_32f( (IppsDFTSpec_R_32f*)spec_r ));
|
||||
IPPI_CALL( ippsDFTInitAlloc_R_32f(
|
||||
(IppsDFTSpec_R_32f**)&spec_r, len, ipp_norm_flag, ippAlgHintNone ));
|
||||
IPPI_CALL( ippsDFTGetBufSize_R_32f( (IppsDFTSpec_R_32f*)spec_r, &ipp_sz ));
|
||||
getSizeFunc = ippsDFTGetSize_R_32f;
|
||||
initFunc = (IppDFTInitFunc)ippsDFTInit_R_32f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( spec_r )
|
||||
IPPI_CALL( ippsDFTFree_R_64f( (IppsDFTSpec_R_64f*)spec_r ));
|
||||
IPPI_CALL( ippsDFTInitAlloc_R_64f(
|
||||
(IppsDFTSpec_R_64f**)&spec_r, len, ipp_norm_flag, ippAlgHintNone ));
|
||||
IPPI_CALL( ippsDFTGetBufSize_R_64f( (IppsDFTSpec_R_64f*)spec_r, &ipp_sz ));
|
||||
getSizeFunc = ippsDFTGetSize_R_64f;
|
||||
initFunc = (IppDFTInitFunc)ippsDFTInit_R_64f;
|
||||
}
|
||||
spec = spec_r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
if( spec_c )
|
||||
IPPI_CALL( ippsDFTFree_C_32fc( (IppsDFTSpec_C_32fc*)spec_c ));
|
||||
IPPI_CALL( ippsDFTInitAlloc_C_32fc(
|
||||
(IppsDFTSpec_C_32fc**)&spec_c, len, ipp_norm_flag, ippAlgHintNone ));
|
||||
IPPI_CALL( ippsDFTGetBufSize_C_32fc( (IppsDFTSpec_C_32fc*)spec_c, &ipp_sz ));
|
||||
getSizeFunc = ippsDFTGetSize_C_32fc;
|
||||
initFunc = (IppDFTInitFunc)ippsDFTInit_C_32fc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( spec_c )
|
||||
IPPI_CALL( ippsDFTFree_C_64fc( (IppsDFTSpec_C_64fc*)spec_c ));
|
||||
IPPI_CALL( ippsDFTInitAlloc_C_64fc(
|
||||
(IppsDFTSpec_C_64fc**)&spec_c, len, ipp_norm_flag, ippAlgHintNone ));
|
||||
IPPI_CALL( ippsDFTGetBufSize_C_64fc( (IppsDFTSpec_C_64fc*)spec_c, &ipp_sz ));
|
||||
getSizeFunc = ippsDFTGetSize_C_64fc;
|
||||
initFunc = (IppDFTInitFunc)ippsDFTInit_C_64fc;
|
||||
}
|
||||
spec = spec_c;
|
||||
}
|
||||
|
||||
sz += ipp_sz;
|
||||
if( getSizeFunc(len, ipp_norm_flag, ippAlgHintNone, &specsize, &initsize, &worksize) >= 0 )
|
||||
{
|
||||
ippbuf.allocate(specsize + initsize + 64);
|
||||
spec = alignPtr(&ippbuf[0], 32);
|
||||
uchar* initbuf = alignPtr((uchar*)spec + specsize, 32);
|
||||
if( initFunc(len, ipp_norm_flag, ippAlgHintNone, spec, initbuf) < 0 )
|
||||
spec = 0;
|
||||
sz += worksize;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -1862,24 +1865,6 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
||||
src = dst;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
if( spec_c )
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
ippsDFTFree_C_32fc( (IppsDFTSpec_C_32fc*)spec_c );
|
||||
else
|
||||
ippsDFTFree_C_64fc( (IppsDFTSpec_C_64fc*)spec_c );
|
||||
}
|
||||
|
||||
if( spec_r )
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
ippsDFTFree_R_32f( (IppsDFTSpec_R_32f*)spec_r );
|
||||
else
|
||||
ippsDFTFree_R_64f( (IppsDFTSpec_R_64f*)spec_r );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,16 +56,39 @@ namespace
|
||||
|
||||
struct DIR
|
||||
{
|
||||
#ifdef HAVE_WINRT
|
||||
WIN32_FIND_DATAW data;
|
||||
#else
|
||||
WIN32_FIND_DATA data;
|
||||
#endif
|
||||
HANDLE handle;
|
||||
dirent ent;
|
||||
#ifdef HAVE_WINRT
|
||||
DIR() {};
|
||||
~DIR()
|
||||
{
|
||||
if (ent.d_name)
|
||||
delete[] ent.d_name;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
DIR* opendir(const char* path)
|
||||
{
|
||||
DIR* dir = new DIR;
|
||||
dir->ent.d_name = 0;
|
||||
dir->handle = ::FindFirstFileA((cv::String(path) + "\\*").c_str(), &dir->data);
|
||||
#ifdef HAVE_WINRT
|
||||
cv::String full_path = cv::String(path) + "\\*";
|
||||
size_t size = mbstowcs(NULL, full_path.c_str(), full_path.size());
|
||||
cv::Ptr<wchar_t> wfull_path = new wchar_t[size+1];
|
||||
wfull_path[size] = 0;
|
||||
mbstowcs(wfull_path, full_path.c_str(), full_path.size());
|
||||
dir->handle = ::FindFirstFileExW(wfull_path, FindExInfoStandard,
|
||||
&dir->data, FindExSearchNameMatch, NULL, 0);
|
||||
#else
|
||||
dir->handle = ::FindFirstFileExA((cv::String(path) + "\\*").c_str(),
|
||||
FindExInfoStandard, &dir->data, FindExSearchNameMatch, NULL, 0);
|
||||
#endif
|
||||
if(dir->handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/*closedir will do all cleanup*/
|
||||
@ -76,12 +99,25 @@ namespace
|
||||
|
||||
dirent* readdir(DIR* dir)
|
||||
{
|
||||
#ifdef HAVE_WINRT
|
||||
if (dir->ent.d_name != 0)
|
||||
{
|
||||
if (::FindNextFile(dir->handle, &dir->data) != TRUE)
|
||||
if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
|
||||
return 0;
|
||||
}
|
||||
size_t asize = wcstombs(NULL, dir->data.cFileName, 0);
|
||||
char* aname = new char[asize+1];
|
||||
aname[asize] = 0;
|
||||
wcstombs(aname, dir->data.cFileName, asize);
|
||||
dir->ent.d_name = aname;
|
||||
#else
|
||||
if (dir->ent.d_name != 0)
|
||||
{
|
||||
if (::FindNextFileA(dir->handle, &dir->data) != TRUE)
|
||||
return 0;
|
||||
}
|
||||
dir->ent.d_name = dir->data.cFileName;
|
||||
#endif
|
||||
return &dir->ent;
|
||||
}
|
||||
|
||||
@ -107,7 +143,19 @@ static bool isDir(const cv::String& path, DIR* dir)
|
||||
if (dir)
|
||||
attributes = dir->data.dwFileAttributes;
|
||||
else
|
||||
attributes = ::GetFileAttributes(path.c_str());
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA all_attrs;
|
||||
#ifdef HAVE_WINRT
|
||||
size_t size = mbstowcs(NULL, path.c_str(), path.size());
|
||||
cv::Ptr<wchar_t> wpath = new wchar_t[size+1];
|
||||
wpath[size] = 0;
|
||||
mbstowcs(wpath, path.c_str(), path.size());
|
||||
::GetFileAttributesExW(wpath, GetFileExInfoStandard, &all_attrs);
|
||||
#else
|
||||
::GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &all_attrs);
|
||||
#endif
|
||||
attributes = all_attrs.dwFileAttributes;
|
||||
}
|
||||
|
||||
return (attributes != INVALID_FILE_ATTRIBUTES) && ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
|
||||
#else
|
||||
|
@ -453,7 +453,11 @@ int cv::getNumberOfCPUs(void)
|
||||
{
|
||||
#if defined WIN32 || defined _WIN32
|
||||
SYSTEM_INFO sysinfo;
|
||||
#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT)
|
||||
GetNativeSystemInfo( &sysinfo );
|
||||
#else
|
||||
GetSystemInfo( &sysinfo );
|
||||
#endif
|
||||
|
||||
return (int)sysinfo.dwNumberOfProcessors;
|
||||
#elif defined ANDROID
|
||||
|
@ -59,7 +59,6 @@
|
||||
#endif
|
||||
|
||||
#if USE_ZLIB
|
||||
# undef HAVE_UNISTD_H //to avoid redefinition
|
||||
# ifndef _LFS64_LARGEFILE
|
||||
# define _LFS64_LARGEFILE 0
|
||||
# endif
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
/* End of file. */
|
@ -43,9 +43,7 @@
|
||||
#ifndef __OPENCV_PRECOMP_H__
|
||||
#define __OPENCV_PRECOMP_H__
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/core/core_c.h"
|
||||
|
@ -726,33 +726,54 @@ void RNG::fill( InputOutputArray _mat, int disttype,
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
|
||||
#ifdef HAVE_WINRT
|
||||
// using C++11 thread attribute for local thread data
|
||||
__declspec( thread ) RNG* rng = NULL;
|
||||
|
||||
void deleteThreadRNGData()
|
||||
{
|
||||
if (rng)
|
||||
delete rng;
|
||||
}
|
||||
|
||||
RNG& theRNG()
|
||||
{
|
||||
if (!rng)
|
||||
{
|
||||
rng = new RNG;
|
||||
}
|
||||
return *rng;
|
||||
}
|
||||
#else
|
||||
#ifdef WINCE
|
||||
# define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
|
||||
#endif
|
||||
static DWORD tlsRNGKey = TLS_OUT_OF_INDEXES;
|
||||
|
||||
void deleteThreadRNGData()
|
||||
{
|
||||
if( tlsRNGKey != TLS_OUT_OF_INDEXES )
|
||||
delete (RNG*)TlsGetValue( tlsRNGKey );
|
||||
void deleteThreadRNGData()
|
||||
{
|
||||
if( tlsRNGKey != TLS_OUT_OF_INDEXES )
|
||||
delete (RNG*)TlsGetValue( tlsRNGKey );
|
||||
}
|
||||
|
||||
RNG& theRNG()
|
||||
{
|
||||
if( tlsRNGKey == TLS_OUT_OF_INDEXES )
|
||||
{
|
||||
tlsRNGKey = TlsAlloc();
|
||||
CV_Assert(tlsRNGKey != TLS_OUT_OF_INDEXES);
|
||||
tlsRNGKey = TlsAlloc();
|
||||
CV_Assert(tlsRNGKey != TLS_OUT_OF_INDEXES);
|
||||
}
|
||||
RNG* rng = (RNG*)TlsGetValue( tlsRNGKey );
|
||||
if( !rng )
|
||||
{
|
||||
rng = new RNG;
|
||||
TlsSetValue( tlsRNGKey, rng );
|
||||
rng = new RNG;
|
||||
TlsSetValue( tlsRNGKey, rng );
|
||||
}
|
||||
return *rng;
|
||||
}
|
||||
|
||||
#endif //HAVE_WINRT
|
||||
#else
|
||||
|
||||
static pthread_key_t tlsRNGKey = 0;
|
||||
|
@ -439,6 +439,45 @@ cv::Scalar cv::sum( InputArray _src )
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = (int)(total_size/rows);
|
||||
if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||
{
|
||||
IppiSize sz = { cols, rows };
|
||||
int type = src.type();
|
||||
typedef IppStatus (CV_STDCALL* ippiSumFunc)(const void*, int, IppiSize, double *, int);
|
||||
ippiSumFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippiSumFunc)ippiSum_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiSumFunc)ippiSum_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiSumFunc)ippiSum_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiSumFunc)ippiSum_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiSumFunc)ippiSum_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiSumFunc)ippiSum_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiSumFunc)ippiSum_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiSumFunc)ippiSum_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiSumFunc)ippiSum_16s_C4R :
|
||||
type == CV_32FC1 ? (ippiSumFunc)ippiSum_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiSumFunc)ippiSum_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiSumFunc)ippiSum_32f_C4R :
|
||||
0;
|
||||
if( ippFunc )
|
||||
{
|
||||
Ipp64f res[4];
|
||||
if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 )
|
||||
{
|
||||
Scalar sc;
|
||||
for( int i = 0; i < cn; i++ )
|
||||
{
|
||||
sc[i] = res[i];
|
||||
}
|
||||
return sc;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SumFunc func = sumTab[depth];
|
||||
|
||||
CV_Assert( cn <= 4 && func != 0 );
|
||||
@ -512,6 +551,81 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8U );
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = (int)(total_size/rows);
|
||||
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
|
||||
{
|
||||
IppiSize sz = { cols, rows };
|
||||
int type = src.type();
|
||||
if( !mask.empty() )
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *);
|
||||
ippiMaskMeanFuncC1 ippFuncC1 =
|
||||
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
|
||||
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
|
||||
type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR :
|
||||
0;
|
||||
if( ippFuncC1 )
|
||||
{
|
||||
Ipp64f res;
|
||||
if( ippFuncC1(src.data, src.step[0], mask.data, mask.step[0], sz, &res) >= 0 )
|
||||
{
|
||||
return Scalar(res);
|
||||
}
|
||||
}
|
||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *);
|
||||
ippiMaskMeanFuncC3 ippFuncC3 =
|
||||
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
|
||||
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
|
||||
type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR :
|
||||
0;
|
||||
if( ippFuncC3 )
|
||||
{
|
||||
Ipp64f res1, res2, res3;
|
||||
if( ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 1, &res1) >= 0 &&
|
||||
ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 2, &res2) >= 0 &&
|
||||
ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 3, &res3) >= 0 )
|
||||
{
|
||||
return Scalar(res1, res2, res3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef IppStatus (CV_STDCALL* ippiMeanFunc)(const void*, int, IppiSize, double *, int);
|
||||
ippiMeanFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippiMeanFunc)ippiMean_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMeanFunc)ippiMean_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMeanFunc)ippiMean_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiMeanFunc)ippiMean_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiMeanFunc)ippiMean_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiMeanFunc)ippiMean_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiMeanFunc)ippiMean_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiMeanFunc)ippiMean_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiMeanFunc)ippiMean_16s_C4R :
|
||||
type == CV_32FC1 ? (ippiMeanFunc)ippiMean_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMeanFunc)ippiMean_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMeanFunc)ippiMean_32f_C4R :
|
||||
0;
|
||||
if( ippFunc )
|
||||
{
|
||||
Ipp64f res[4];
|
||||
if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 )
|
||||
{
|
||||
Scalar sc;
|
||||
for( int i = 0; i < cn; i++ )
|
||||
{
|
||||
sc[i] = res[i];
|
||||
}
|
||||
return sc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SumFunc func = sumTab[depth];
|
||||
|
||||
CV_Assert( cn <= 4 && func != 0 );
|
||||
|
@ -47,6 +47,9 @@
|
||||
#define _WIN32_WINNT 0x0400 // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#if (_WIN32_WINNT >= 0x0602)
|
||||
#include <synchapi.h>
|
||||
#endif
|
||||
#undef small
|
||||
#undef min
|
||||
#undef max
|
||||
@ -75,6 +78,30 @@
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINRT
|
||||
#include <wrl/client.h>
|
||||
|
||||
std::wstring GetTempPathWinRT()
|
||||
{
|
||||
return std::wstring(Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data());
|
||||
}
|
||||
|
||||
std::wstring GetTempFileNameWinRT(std::wstring prefix)
|
||||
{
|
||||
wchar_t guidStr[40];
|
||||
GUID g;
|
||||
CoCreateGuid(&g);
|
||||
wchar_t* mask = L"%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x";
|
||||
swprintf(&guidStr[0], sizeof(guidStr)/sizeof(wchar_t), mask,
|
||||
g.Data1, g.Data2, g.Data3, UINT(g.Data4[0]), UINT(g.Data4[1]),
|
||||
UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]),
|
||||
UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7]));
|
||||
|
||||
return prefix + std::wstring(guidStr);
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
@ -359,10 +386,38 @@ string format( const char* fmt, ... )
|
||||
|
||||
string tempfile( const char* suffix )
|
||||
{
|
||||
#ifdef HAVE_WINRT
|
||||
std::wstring temp_dir = L"";
|
||||
const wchar_t* opencv_temp_dir = _wgetenv(L"OPENCV_TEMP_PATH");
|
||||
if (opencv_temp_dir)
|
||||
temp_dir = std::wstring(opencv_temp_dir);
|
||||
#else
|
||||
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
|
||||
#endif
|
||||
string fname;
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
#ifdef HAVE_WINRT
|
||||
RoInitialize(RO_INIT_MULTITHREADED);
|
||||
std::wstring temp_dir2;
|
||||
if (temp_dir.empty())
|
||||
temp_dir = GetTempPathWinRT();
|
||||
|
||||
std::wstring temp_file;
|
||||
temp_file = GetTempFileNameWinRT(L"ocv");
|
||||
if (temp_file.empty())
|
||||
return std::string();
|
||||
|
||||
temp_file = temp_dir + std::wstring(L"\\") + temp_file;
|
||||
DeleteFileW(temp_file.c_str());
|
||||
|
||||
size_t asize = wcstombs(NULL, temp_file.c_str(), 0);
|
||||
Ptr<char> aname = new char[asize+1];
|
||||
aname[asize] = 0;
|
||||
wcstombs(aname, temp_file.c_str(), asize);
|
||||
fname = std::string(aname);
|
||||
RoUninitialize();
|
||||
#else
|
||||
char temp_dir2[MAX_PATH + 1] = { 0 };
|
||||
char temp_file[MAX_PATH + 1] = { 0 };
|
||||
|
||||
@ -377,6 +432,7 @@ string tempfile( const char* suffix )
|
||||
DeleteFileA(temp_file);
|
||||
|
||||
fname = temp_file;
|
||||
#endif
|
||||
# else
|
||||
# ifdef ANDROID
|
||||
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
|
||||
@ -469,40 +525,6 @@ redirectError( CvErrorCallback errCallback, void* userdata, void** prevUserdata)
|
||||
|
||||
}
|
||||
|
||||
/*CV_IMPL int
|
||||
cvGuiBoxReport( int code, const char *func_name, const char *err_msg,
|
||||
const char *file, int line, void* )
|
||||
{
|
||||
#if (!defined WIN32 && !defined _WIN32) || defined WINCE
|
||||
return cvStdErrReport( code, func_name, err_msg, file, line, 0 );
|
||||
#else
|
||||
if( code != CV_StsBackTrace && code != CV_StsAutoTrace )
|
||||
{
|
||||
size_t msg_len = strlen(err_msg ? err_msg : "") + 1024;
|
||||
char* message = (char*)alloca(msg_len);
|
||||
char title[100];
|
||||
|
||||
wsprintf( message, "%s (%s)\nin function %s, %s(%d)\n\n"
|
||||
"Press \"Abort\" to terminate application.\n"
|
||||
"Press \"Retry\" to debug (if the app is running under debugger).\n"
|
||||
"Press \"Ignore\" to continue (this is not safe).\n",
|
||||
cvErrorStr(code), err_msg ? err_msg : "no description",
|
||||
func_name, file, line );
|
||||
|
||||
wsprintf( title, "OpenCV GUI Error Handler" );
|
||||
|
||||
int answer = MessageBox( NULL, message, title, MB_ICONERROR|MB_ABORTRETRYIGNORE|MB_SYSTEMMODAL );
|
||||
|
||||
if( answer == IDRETRY )
|
||||
{
|
||||
CV_DBG_BREAK();
|
||||
}
|
||||
return answer != IDIGNORE;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}*/
|
||||
|
||||
CV_IMPL int cvCheckHardwareSupport(int feature)
|
||||
{
|
||||
CV_DbgAssert( 0 <= feature && feature <= CV_HARDWARE_MAX_FEATURE );
|
||||
@ -779,7 +801,11 @@ cvGetModuleInfo( const char* name, const char **version, const char **plugin_lis
|
||||
*plugin_list = plugin_list_buf;
|
||||
}
|
||||
|
||||
#if defined BUILD_SHARED_LIBS && defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
||||
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
||||
#ifdef HAVE_WINRT
|
||||
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
||||
#endif
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID );
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
|
||||
@ -800,7 +826,15 @@ namespace cv
|
||||
|
||||
struct Mutex::Impl
|
||||
{
|
||||
Impl() { InitializeCriticalSection(&cs); refcount = 1; }
|
||||
Impl()
|
||||
{
|
||||
#if (_WIN32_WINNT >= 0x0600)
|
||||
::InitializeCriticalSectionEx(&cs, 1000, 0);
|
||||
#else
|
||||
::InitializeCriticalSection(&cs);
|
||||
#endif
|
||||
refcount = 1;
|
||||
}
|
||||
~Impl() { DeleteCriticalSection(&cs); }
|
||||
|
||||
void lock() { EnterCriticalSection(&cs); }
|
||||
@ -904,4 +938,4 @@ bool Mutex::trylock() { return impl->trylock(); }
|
||||
|
||||
}
|
||||
|
||||
/* End of file. */
|
||||
/* End of file. */
|
||||
|
@ -1123,7 +1123,7 @@ struct MeanOp : public BaseElemWiseOp
|
||||
}
|
||||
double getMaxErr(int)
|
||||
{
|
||||
return 1e-6;
|
||||
return 1e-5;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
#ifdef HAVE_WINRT
|
||||
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
||||
#endif
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
CV_TEST_MAIN("cv")
|
||||
|
@ -1 +0,0 @@
|
||||
#include "test_precomp.hpp"
|
@ -9,7 +9,10 @@ represented as vectors in a multidimensional space. All objects that implement t
|
||||
descriptor extractors inherit the
|
||||
:ocv:class:`DescriptorExtractor` interface.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example explaining keypoint extraction can be found at opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp
|
||||
* An example on descriptor evaluation can be found at opencv_source_code/samples/cpp/detector_descriptor_evaluation.cpp
|
||||
|
||||
DescriptorExtractor
|
||||
-------------------
|
||||
@ -78,9 +81,10 @@ The current implementation supports the following types of a descriptor extracto
|
||||
|
||||
* ``"SIFT"`` -- :ocv:class:`SIFT`
|
||||
* ``"SURF"`` -- :ocv:class:`SURF`
|
||||
* ``"ORB"`` -- :ocv:class:`ORB`
|
||||
* ``"BRISK"`` -- :ocv:class:`BRISK`
|
||||
* ``"BRIEF"`` -- :ocv:class:`BriefDescriptorExtractor`
|
||||
* ``"BRISK"`` -- :ocv:class:`BRISK`
|
||||
* ``"ORB"`` -- :ocv:class:`ORB`
|
||||
* ``"FREAK"`` -- :ocv:class:`FREAK`
|
||||
|
||||
A combined format is also supported: descriptor extractor adapter name ( ``"Opponent"`` --
|
||||
:ocv:class:`OpponentColorDescriptorExtractor` ) + descriptor extractor name (see above),
|
||||
@ -137,4 +141,6 @@ Strecha C., Fua P. *BRIEF: Binary Robust Independent Elementary Features* ,
|
||||
...
|
||||
};
|
||||
|
||||
.. note::
|
||||
|
||||
* A complete BRIEF extractor sample can be found at opencv_source_code/samples/cpp/brief_match_test.cpp
|
||||
|
@ -9,6 +9,12 @@ that are represented as vectors in a multidimensional space. All objects that im
|
||||
descriptor matchers inherit the
|
||||
:ocv:class:`DescriptorMatcher` interface.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example explaining keypoint matching can be found at opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp
|
||||
* An example on descriptor matching evaluation can be found at opencv_source_code/samples/cpp/detector_descriptor_matcher_evaluation.cpp
|
||||
* An example on one to many image matching can be found at opencv_source_code/samples/cpp/matching_to_many_images.cpp
|
||||
|
||||
DMatch
|
||||
------
|
||||
.. ocv:struct:: DMatch
|
||||
|
@ -8,6 +8,11 @@ between different algorithms solving the same problem. All objects that implemen
|
||||
inherit the
|
||||
:ocv:class:`FeatureDetector` interface.
|
||||
|
||||
.. note::
|
||||
|
||||
* An example explaining keypoint detection can be found at opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp
|
||||
|
||||
|
||||
KeyPoint
|
||||
--------
|
||||
.. ocv:class:: KeyPoint
|
||||
@ -220,7 +225,7 @@ StarFeatureDetector
|
||||
-------------------
|
||||
.. ocv:class:: StarFeatureDetector : public FeatureDetector
|
||||
|
||||
The class implements the keypoint detector introduced by K. Konolige, synonym of ``StarDetector``. ::
|
||||
The class implements the keypoint detector introduced by [Agrawal08]_, synonym of ``StarDetector``. ::
|
||||
|
||||
class StarFeatureDetector : public FeatureDetector
|
||||
{
|
||||
@ -234,6 +239,9 @@ The class implements the keypoint detector introduced by K. Konolige, synonym of
|
||||
...
|
||||
};
|
||||
|
||||
.. [Agrawal08] Agrawal, M., Konolige, K., & Blas, M. R. (2008). Censure: Center surround extremas for realtime feature detection and matching. In Computer Vision–ECCV 2008 (pp. 102-115). Springer Berlin Heidelberg.
|
||||
|
||||
|
||||
DenseFeatureDetector
|
||||
--------------------
|
||||
.. ocv:class:: DenseFeatureDetector : public FeatureDetector
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user