mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
Compare commits
170 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb4c2ba64d | |||
| e53f1b2532 | |||
| 621a1d3b09 | |||
| 14b686cdc7 | |||
| 0202e52747 | |||
| 7997e7aee9 | |||
| b43e5e2d21 | |||
| c92ecc7f96 | |||
| ae52d94ceb | |||
| 37d4e24806 | |||
| 7b861cac9f | |||
| da9395b592 | |||
| df1a026329 | |||
| dd9bf1ba1d | |||
| 30f7576029 | |||
| f548d660ba | |||
| 8a2bbc57e4 | |||
| e575b5ff9a | |||
| 355553b0a6 | |||
| d25b04149a | |||
| 268d17e086 | |||
| d567a79581 | |||
| 3ba7c16670 | |||
| f7d99f3f6a | |||
| 126de0cd95 | |||
| 72d29259ca | |||
| c9488c661f | |||
| 4852f017fa | |||
| b398b572cc | |||
| a0520bef42 | |||
| 7dceebbc4e | |||
| 0312df4812 | |||
| d19147bc78 | |||
| fc2a71dbab | |||
| 6bafc2c598 | |||
| 777a0080cb | |||
| 572c86176a | |||
| 8736ece97d | |||
| ebd961585e | |||
| 2e343ef631 | |||
| af3c544483 | |||
| 3dedd62f54 | |||
| 07b7c03efc | |||
| aae7621243 | |||
| fa36e769cf | |||
| f71bf21aaf | |||
| 70489b1e22 | |||
| e397794ae2 | |||
| 3d4e1bd641 | |||
| 3649ee3cd3 | |||
| d0f3a14456 | |||
| 01e34b6a91 | |||
| df5c090f2e | |||
| 27213a845f | |||
| 91a6940930 | |||
| 7577f1420d | |||
| c72a191145 | |||
| 34d7b96bfc | |||
| 160f26192c | |||
| 9e76ba5ccd | |||
| ec784331fb | |||
| 61936eb1a4 | |||
| d856604a4a | |||
| ab806b63a7 | |||
| 0051744fa0 | |||
| b8d99e1ffb | |||
| 54f65a4672 | |||
| d103c116db | |||
| e304795622 | |||
| ebae963884 | |||
| 19e4c7727b | |||
| f2a59b3d94 | |||
| 88bc0f7838 | |||
| 2346ba7ea2 | |||
| f5db748312 | |||
| 3e66654963 | |||
| f108795e2c | |||
| 6ed571b3c6 | |||
| 9d45f15627 | |||
| d7504ecaed | |||
| c7ae26bf24 | |||
| 8444c23803 | |||
| 22df206e1f | |||
| b06bd50144 | |||
| cc09f5a7de | |||
| 49e6bb2993 | |||
| 667cb2e9fc | |||
| 041502e42c | |||
| d206e84a13 | |||
| 03beff06ff | |||
| 7db13c7aab | |||
| af0ee306cf | |||
| 7241b90dec | |||
| ffcf866e2f | |||
| 7bceef715c | |||
| 26fbaada0a | |||
| 6946f510fe | |||
| 62c9ff25e5 | |||
| ab429d2e73 | |||
| 21f3531b17 | |||
| 7be4a0ee2f | |||
| 25727454d9 | |||
| 29f5294fd2 | |||
| cf97e6e00f | |||
| bc96997410 | |||
| c6af179afc | |||
| ab260dafd2 | |||
| 10d1b33a80 | |||
| a05444618c | |||
| d42d155c16 | |||
| 2d28bb4171 | |||
| 3d8395cae9 | |||
| 2af4dc7249 | |||
| 5cead19006 | |||
| 7e38a2f0bb | |||
| 32f568308a | |||
| 5ac15f09ed | |||
| 36d7712c2c | |||
| e5041abe55 | |||
| 90da593316 | |||
| ac118aee78 | |||
| f6d5a1dd2c | |||
| 56ed8b1721 | |||
| e878b60dbc | |||
| 11b642fb8c | |||
| 6fb75c677b | |||
| 4a759abe39 | |||
| 979b0ae9ce | |||
| 408e4a7c27 | |||
| da75d129fe | |||
| a3bfa6f566 | |||
| 8e22b17919 | |||
| af8e6b06f7 | |||
| 7b13550bdd | |||
| 62b2039040 | |||
| f21f153a5f | |||
| 3ea4f72e35 | |||
| b1c8557401 | |||
| 0a543c5531 | |||
| a42be1f9bd | |||
| 19270eeab4 | |||
| 497d0fd2e7 | |||
| 21167b1bf1 | |||
| 4d041e6809 | |||
| 4d84e6efee | |||
| 8f4251fbfa | |||
| 64a2d1904b | |||
| d23190dc3e | |||
| f632f5c552 | |||
| f0d592e6b6 | |||
| c585d3890e | |||
| e3070ed553 | |||
| 8577f71810 | |||
| 6f00e53159 | |||
| 422154dc97 | |||
| 50486bd34d | |||
| 1c409abe9c | |||
| c419552002 | |||
| 4e7f28811c | |||
| c7c831bca5 | |||
| 80f03f58e7 | |||
| a34b8d4abf | |||
| 72becbbb1f | |||
| c181f2f493 | |||
| 36db16a00d | |||
| 26a32dcbf6 | |||
| f1009e2234 | |||
| 9ff63a46fc | |||
| c314178e7a | |||
| 3648c61172 |
@@ -7,3 +7,4 @@
|
||||
.sw[a-z]
|
||||
tags
|
||||
tegra/
|
||||
.cache
|
||||
|
||||
Vendored
+10
-12
@@ -1,13 +1,11 @@
|
||||
set(HAVE_FFMPEG 1)
|
||||
set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
set(HAVE_FFMPEG_RESAMPLE 0)
|
||||
set(HAVE_GENTOO_FFMPEG 1)
|
||||
set(FFMPEG_libavcodec_FOUND 1)
|
||||
set(FFMPEG_libavformat_FOUND 1)
|
||||
set(FFMPEG_libavutil_FOUND 1)
|
||||
set(FFMPEG_libswscale_FOUND 1)
|
||||
set(FFMPEG_libavresample_FOUND 1)
|
||||
|
||||
set(ALIASOF_libavcodec_VERSION 55.18.102)
|
||||
set(ALIASOF_libavformat_VERSION 55.12.100)
|
||||
set(ALIASOF_libavutil_VERSION 52.38.100)
|
||||
set(ALIASOF_libswscale_VERSION 2.3.100)
|
||||
set(ALIASOF_libavresample_VERSION 1.0.1)
|
||||
set(FFMPEG_libavcodec_VERSION 55.18.102)
|
||||
set(FFMPEG_libavformat_VERSION 55.12.100)
|
||||
set(FFMPEG_libavutil_VERSION 52.38.100)
|
||||
set(FFMPEG_libswscale_VERSION 2.3.100)
|
||||
set(FFMPEG_libavresample_VERSION 1.0.1)
|
||||
|
||||
Vendored
+2
@@ -38,6 +38,8 @@ set_target_properties(${JASPER_LIBRARY}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${JASPER_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${JASPER_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${JASPER_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
-1
@@ -842,7 +842,6 @@ static int jas_cmshapmat_apply(jas_cmpxform_t *pxform, jas_cmreal_t *in,
|
||||
*dst++ = a2;
|
||||
}
|
||||
} else {
|
||||
assert(0);
|
||||
while (--cnt >= 0) {
|
||||
a0 = *src++;
|
||||
src++;
|
||||
|
||||
Vendored
+5
-2
@@ -345,6 +345,7 @@ jas_stream_t *jas_stream_tmpfile()
|
||||
{
|
||||
jas_stream_t *stream;
|
||||
jas_stream_fileobj_t *obj;
|
||||
char *tmpname;
|
||||
|
||||
if (!(stream = jas_stream_create())) {
|
||||
return 0;
|
||||
@@ -365,10 +366,12 @@ jas_stream_t *jas_stream_tmpfile()
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Choose a file name. */
|
||||
tmpnam(obj->pathname);
|
||||
tmpname = tempnam(NULL, NULL);
|
||||
strcpy(obj->pathname, tmpname);
|
||||
free(tmpname);
|
||||
|
||||
/* Open the underlying file. */
|
||||
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
|
||||
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY | O_TEMPORARY | _O_SHORT_LIVED,
|
||||
JAS_STREAM_PERMS)) < 0) {
|
||||
jas_stream_destroy(stream);
|
||||
return 0;
|
||||
|
||||
Vendored
+2
@@ -31,6 +31,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wshift-negative-value) #
|
||||
set_target_properties(${JPEG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${JPEG_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${JPEG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+2
@@ -49,6 +49,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
|
||||
set_target_properties(${PNG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${PNG_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${PNG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+4
-2
@@ -86,7 +86,7 @@ else()
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
|
||||
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
|
||||
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wmisleading-indentation)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
|
||||
@@ -95,7 +95,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018 /wd4311 /wd4312)
|
||||
|
||||
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
@@ -108,6 +108,8 @@ set_target_properties(${TIFF_LIBRARY}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "${TIFF_LIBRARY}"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${TIFF_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${TIFF_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+9
-2
@@ -37,8 +37,8 @@ endif()
|
||||
source_group("Include" FILES ${lib_hdrs} )
|
||||
source_group("Src" FILES ${lib_srcs})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra
|
||||
-Wdeprecated-declarations -Wmisleading-indentation)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
||||
@@ -49,6 +49,11 @@ if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif()
|
||||
|
||||
if(MSVC AND CV_ICC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qrestrict")
|
||||
endif()
|
||||
|
||||
add_library(IlmImf STATIC ${lib_hdrs} ${lib_srcs})
|
||||
target_link_libraries(IlmImf ${ZLIB_LIBRARIES})
|
||||
|
||||
@@ -56,6 +61,8 @@ set_target_properties(IlmImf
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "IlmImf"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME "IlmImf"
|
||||
COMPILE_PDB_NAME_DEBUG "IlmImf${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -187,7 +187,7 @@ if (HAVE_LIBPTHREAD)
|
||||
add_definitions(-DUSE_PTHREAD) #required for Unix
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_COMPILER_IS_CLANGCXX)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1) #required for ARM GCC
|
||||
endif()
|
||||
|
||||
@@ -245,6 +245,8 @@ endif()
|
||||
set_target_properties(tbb
|
||||
PROPERTIES OUTPUT_NAME tbb
|
||||
DEBUG_POSTFIX "${tbb_debug_postfix}"
|
||||
COMPILE_PDB_NAME tbb
|
||||
COMPILE_PDB_NAME_DEBUG "tbb${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
Vendored
+2
@@ -87,6 +87,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prot
|
||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
||||
OUTPUT_NAME ${ZLIB_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${ZLIB_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${ZLIB_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
+50
-58
@@ -4,11 +4,16 @@
|
||||
# From the off-tree build directory, invoke:
|
||||
# $ cmake <PATH_TO_OPENCV_ROOT>
|
||||
#
|
||||
#
|
||||
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Disable in-source builds to prevent source tree corruption.
|
||||
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
|
||||
message(FATAL_ERROR "
|
||||
FATAL: In-source builds are not allowed.
|
||||
You should create a separate directory for build files.
|
||||
")
|
||||
endif()
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
# Following block can broke build in case of cross-compilng
|
||||
@@ -32,24 +37,15 @@ endif(NOT CMAKE_TOOLCHAIN_FILE)
|
||||
# Top level OpenCV project
|
||||
# --------------------------------------------------------------
|
||||
if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3)
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
elseif(IOS)
|
||||
cmake_minimum_required(VERSION 2.8.0)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 2.6.3)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0017)
|
||||
cmake_policy(SET CMP0017 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0022)
|
||||
cmake_policy(SET CMP0022 OLD)
|
||||
cmake_minimum_required(VERSION 2.8.12.2)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0026)
|
||||
# silence cmake 3.0+ warnings about reading LOCATION attribute
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
cmake_policy(SET CMP0026 NEW)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0042)
|
||||
@@ -73,14 +69,16 @@ endif()
|
||||
|
||||
include(cmake/OpenCVUtils.cmake)
|
||||
|
||||
ocv_cmake_eval(DEBUG_PRE ONCE)
|
||||
|
||||
ocv_clear_vars(OpenCVModules_TARGETS)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Break in case of popular CMake configuration mistakes
|
||||
# ----------------------------------------------------------------------------
|
||||
if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
|
||||
message(FATAL_ERROR "CMake fails to deterimine the bitness of target platform.
|
||||
Please check your CMake and compiler installation. If you are crosscompiling then ensure that your CMake toolchain file correctly sets the compiler details.")
|
||||
message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
|
||||
Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -137,7 +135,7 @@ endif()
|
||||
# Optional 3rd party components
|
||||
# ===================================================
|
||||
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
|
||||
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON IF APPLE)
|
||||
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" OFF IF (NOT ANDROID AND NOT IOS AND NOT CMAKE_CROSSCOMPILING) )
|
||||
@@ -162,7 +160,8 @@ OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON
|
||||
OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
|
||||
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF WIN32 )
|
||||
@@ -190,7 +189,7 @@ OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command"
|
||||
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) )
|
||||
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) )
|
||||
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
|
||||
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
|
||||
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for staticaly linked OpenCV" ON IF MSVC )
|
||||
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
|
||||
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
|
||||
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
|
||||
@@ -216,6 +215,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar
|
||||
|
||||
# OpenCV build options
|
||||
# ===================================================
|
||||
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) )
|
||||
OCV_OPTION(ENABLE_DYNAMIC_CUDA "Enabled dynamic CUDA linkage" ON IF ANDROID )
|
||||
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
|
||||
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
|
||||
@@ -274,12 +274,14 @@ if (ANDROID)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID OR WIN32)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
elseif(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV-${OPENCV_VERSION}/doc)
|
||||
else()
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
if(NOT DEFINED OPENCV_DOC_INSTALL_PATH)
|
||||
if(ANDROID OR WIN32)
|
||||
set(OPENCV_DOC_INSTALL_PATH doc)
|
||||
elseif(INSTALL_TO_MANGLED_PATHS)
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV-${OPENCV_VERSION}/doc)
|
||||
else()
|
||||
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@@ -443,10 +445,6 @@ endif(WIN32 AND NOT MINGW)
|
||||
# CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
|
||||
# ----------------------------------------------------------------------------
|
||||
if(UNIX)
|
||||
include(cmake/OpenCVFindPkgConfig.cmake OPTIONAL)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(NOT APPLE)
|
||||
CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
|
||||
if(ANDROID)
|
||||
@@ -705,10 +703,6 @@ endif()
|
||||
# ========================== C/C++ options ==========================
|
||||
if(CMAKE_CXX_COMPILER_VERSION)
|
||||
set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION})")
|
||||
elseif(CMAKE_COMPILER_IS_CLANGCXX)
|
||||
set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CLANG_REGEX_VERSION})")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_GCC_REGEX_VERSION})")
|
||||
else()
|
||||
set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
|
||||
endif()
|
||||
@@ -730,6 +724,7 @@ else()
|
||||
status(" Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
|
||||
status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
|
||||
endif()
|
||||
status(" ccache:" CMAKE_COMPILER_IS_CCACHE THEN YES ELSE NO)
|
||||
status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
|
||||
|
||||
# ========================== OpenCV modules ==========================
|
||||
@@ -879,23 +874,18 @@ if(ANDROID)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED WITH_AVFOUNDATION)
|
||||
status(" AVFoundation:" WITH_AVFOUNDATION THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_AVFOUNDATION)
|
||||
|
||||
if(DEFINED WITH_FFMPEG)
|
||||
if(DEFINED WITH_FFMPEG OR HAVE_FFMPEG)
|
||||
if(WIN32)
|
||||
status(" FFMPEG:" WITH_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
|
||||
else()
|
||||
status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
|
||||
endif()
|
||||
status(" codec:" HAVE_FFMPEG_CODEC THEN "YES (ver ${ALIASOF_libavcodec_VERSION})" ELSE NO)
|
||||
status(" format:" HAVE_FFMPEG_FORMAT THEN "YES (ver ${ALIASOF_libavformat_VERSION})" ELSE NO)
|
||||
status(" util:" HAVE_FFMPEG_UTIL THEN "YES (ver ${ALIASOF_libavutil_VERSION})" ELSE NO)
|
||||
status(" swscale:" HAVE_FFMPEG_SWSCALE THEN "YES (ver ${ALIASOF_libswscale_VERSION})" ELSE NO)
|
||||
status(" resample:" HAVE_FFMPEG_RESAMPLE THEN "YES (ver ${ALIASOF_libavresample_VERSION})" ELSE NO)
|
||||
status(" gentoo-style:" HAVE_GENTOO_FFMPEG THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_FFMPEG)
|
||||
status(" avcodec:" FFMPEG_libavcodec_FOUND THEN "YES (ver ${FFMPEG_libavcodec_VERSION})" ELSE NO)
|
||||
status(" avformat:" FFMPEG_libavformat_FOUND THEN "YES (ver ${FFMPEG_libavformat_VERSION})" ELSE NO)
|
||||
status(" avutil:" FFMPEG_libavutil_FOUND THEN "YES (ver ${FFMPEG_libavutil_VERSION})" ELSE NO)
|
||||
status(" swscale:" FFMPEG_libswscale_FOUND THEN "YES (ver ${FFMPEG_libswscale_VERSION})" ELSE NO)
|
||||
status(" avresample:" FFMPEG_libavresample_FOUND THEN "YES (ver ${FFMPEG_libavresample_VERSION})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(DEFINED WITH_GSTREAMER)
|
||||
status(" GStreamer:" HAVE_GSTREAMER THEN "" ELSE NO)
|
||||
@@ -923,10 +913,15 @@ if(DEFINED WITH_GIGEAPI)
|
||||
status(" GigEVisionSDK:" HAVE_GIGE_API THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_GIGEAPI)
|
||||
|
||||
if(DEFINED WITH_QUICKTIME)
|
||||
if(DEFINED APPLE)
|
||||
status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
|
||||
if(WITH_QUICKTIME OR HAVE_QUICKTIME)
|
||||
status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO)
|
||||
status(" QTKit:" HAVE_QTKIT THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_QUICKTIME)
|
||||
endif()
|
||||
if(WITH_QTKIT OR HAVE_QTKIT)
|
||||
status(" QTKit:" HAVE_QTKIT THEN "YES (deprecated)" ELSE NO)
|
||||
endif()
|
||||
endif(DEFINED APPLE)
|
||||
|
||||
if(DEFINED WITH_UNICAP)
|
||||
status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${ALIASOF_libunicap_VERSION})" ELSE NO)
|
||||
@@ -1021,7 +1016,7 @@ if(HAVE_OPENCL)
|
||||
set(__libs "")
|
||||
foreach(l ${OPENCL_LIBRARIES})
|
||||
if(TARGET ${l})
|
||||
get_target_property(p ${l} LOCATION)
|
||||
get_target_property(p ${l} IMPORTED_LOCATION)
|
||||
if(p MATCHES NOTFOUND)
|
||||
list(APPEND __libs "${l}")
|
||||
else()
|
||||
@@ -1091,15 +1086,12 @@ status("")
|
||||
|
||||
ocv_finalize_status()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Warn in the case of in-source build
|
||||
# ----------------------------------------------------------------------------
|
||||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CPack stuff
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
include(cmake/OpenCVPackaging.cmake)
|
||||
|
||||
# This should be the last command
|
||||
ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
|
||||
ocv_cmake_eval(DEBUG_POST ONCE)
|
||||
|
||||
@@ -4,3 +4,4 @@ add_subdirectory(haartraining)
|
||||
add_subdirectory(traincascade)
|
||||
add_subdirectory(annotation)
|
||||
add_subdirectory(visualisation)
|
||||
add_subdirectory(version)
|
||||
|
||||
@@ -10,6 +10,8 @@ project(haartraining)
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${OPENCV_HAARTRAINING_DEPS})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-private-field)
|
||||
|
||||
if(WIN32)
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
|
||||
// std::auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 6
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "cvhaartraining.h"
|
||||
|
||||
@@ -10,6 +10,8 @@ project(traincascade)
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${OPENCV_TRAINCASCADE_DEPS})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Woverloaded-virtual)
|
||||
|
||||
set(traincascade_files traincascade.cpp
|
||||
cascadeclassifier.cpp cascadeclassifier.h
|
||||
boost.cpp boost.h features.cpp traincascade_features.h
|
||||
|
||||
@@ -140,7 +140,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
double acceptanceRatioBreakValue)
|
||||
{
|
||||
// Start recording clock ticks for training time output
|
||||
const clock_t begin_time = clock();
|
||||
double time = (double)getTickCount();
|
||||
|
||||
if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() )
|
||||
CV_Error( CV_StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" );
|
||||
@@ -268,7 +268,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
fs << "}";
|
||||
|
||||
// Output training time up till now
|
||||
float seconds = float( clock () - begin_time ) / CLOCKS_PER_SEC;
|
||||
double seconds = ( (double)getTickCount() - time)/ getTickFrequency();
|
||||
int days = int(seconds) / 60 / 60 / 24;
|
||||
int hours = (int(seconds) / 60 / 60) % 24;
|
||||
int minutes = (int(seconds) / 60) % 60;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
SET(OPENCV_APPLICATION_DEPS opencv_core)
|
||||
ocv_check_dependencies(${OPENCV_APPLICATION_DEPS})
|
||||
|
||||
if(NOT OCV_DEPENDENCIES_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(opencv_version)
|
||||
set(the_target opencv_version)
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
|
||||
ocv_include_modules(${OPENCV_APPLICATION_DEPS})
|
||||
|
||||
file(GLOB SRCS *.cpp)
|
||||
|
||||
add_executable(${the_target} ${SRCS})
|
||||
target_link_libraries(${the_target} ${OPENCV_APPLICATION_DEPS})
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
OUTPUT_NAME "opencv_version")
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "applications")
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT libs)
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs)
|
||||
endif()
|
||||
@@ -0,0 +1,28 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
cv::CommandLineParser parser(argc, argv,
|
||||
"{ h|help | false | show this help message }"
|
||||
"{ v|verbose | false | show build configuration log }"
|
||||
);
|
||||
if (parser.get<bool>("help"))
|
||||
{
|
||||
parser.printParams();
|
||||
}
|
||||
else if (parser.get<bool>("verbose"))
|
||||
{
|
||||
std::cout << cv::getBuildInformation().c_str() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << CV_VERSION << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1553,7 +1553,7 @@ macro(CUDA_ADD_LIBRARY cuda_target)
|
||||
# variable will have been defined.
|
||||
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
|
||||
|
||||
target_link_libraries(${cuda_target}
|
||||
target_link_libraries(${cuda_target} LINK_PRIVATE
|
||||
${CUDA_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -1597,7 +1597,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target)
|
||||
# variable will have been defined.
|
||||
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
|
||||
|
||||
target_link_libraries(${cuda_target}
|
||||
target_link_libraries(${cuda_target} LINK_PRIVATE
|
||||
${CUDA_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -1672,9 +1672,9 @@ endmacro()
|
||||
###############################################################################
|
||||
macro(CUDA_ADD_CUFFT_TO_TARGET target)
|
||||
if (CUDA_BUILD_EMULATION)
|
||||
target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
|
||||
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cufftemu_LIBRARY})
|
||||
else()
|
||||
target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
|
||||
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -1685,9 +1685,9 @@ endmacro()
|
||||
###############################################################################
|
||||
macro(CUDA_ADD_CUBLAS_TO_TARGET target)
|
||||
if (CUDA_BUILD_EMULATION)
|
||||
target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
|
||||
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cublasemu_LIBRARY})
|
||||
else()
|
||||
target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
|
||||
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cublas_LIBRARY})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
if(ENABLE_CCACHE AND NOT CMAKE_COMPILER_IS_CCACHE)
|
||||
# This works fine with Unix Makefiles and Ninja generators
|
||||
find_host_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
message(STATUS "Looking for ccache - found (${CCACHE_PROGRAM})")
|
||||
get_property(__OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
if(__OLD_RULE_LAUNCH_COMPILE)
|
||||
message(STATUS "Can't replace CMake compiler launcher")
|
||||
else()
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
# NOTE: Actually this check doesn't work as expected.
|
||||
# "RULE_LAUNCH_COMPILE" is ignored by CMake during try_compile() step.
|
||||
# ocv_check_compiler_flag(CXX "" IS_CCACHE_WORKS)
|
||||
set(IS_CCACHE_WORKS 1)
|
||||
if(IS_CCACHE_WORKS)
|
||||
set(CMAKE_COMPILER_IS_CCACHE 1)
|
||||
else()
|
||||
message(STATUS "Unable to compile program with enabled ccache, reverting...")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${__OLD_RULE_LAUNCH_COMPILE}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Looking for ccache - not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_CCACHE) AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if(MINGW OR (X86 AND UNIX AND NOT APPLE))
|
||||
# mingw compiler is known to produce unstable SSE code with -O3 hence we are trying to use -O2 instead
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
@@ -67,6 +97,10 @@ if(BUILD_TINY_GPU_MODULE)
|
||||
add_definitions(-DOPENCV_TINY_GPU_MODULE)
|
||||
endif()
|
||||
|
||||
if(CV_ICC AND NOT ENABLE_FAST_MATH)
|
||||
add_extra_compiler_option("-fp-model precise")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# High level of warnings.
|
||||
add_extra_compiler_option(-W)
|
||||
@@ -95,6 +129,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_extra_compiler_option(-Wno-narrowing)
|
||||
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
|
||||
add_extra_compiler_option(-Wno-unnamed-type-template-args)
|
||||
add_extra_compiler_option(-Wno-comment)
|
||||
add_extra_compiler_option(-Wno-array-bounds)
|
||||
add_extra_compiler_option(-Wno-aggressive-loop-optimizations)
|
||||
endif()
|
||||
@@ -110,6 +145,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_extra_compiler_option(-pthread)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANGCXX)
|
||||
add_extra_compiler_option(-Qunused-arguments)
|
||||
endif()
|
||||
|
||||
if(OPENCV_WARNINGS_ARE_ERRORS)
|
||||
add_extra_compiler_option(-Werror)
|
||||
endif()
|
||||
@@ -207,7 +246,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
|
||||
if(NOT " ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} " MATCHES "-O")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0")
|
||||
endif()
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -306,8 +348,13 @@ if(MSVC)
|
||||
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
|
||||
if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
|
||||
endif()
|
||||
if(MSVC_VERSION LESS 1900) # MSVS2015
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # warning C4127: conditional expression is constant
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# allow extern "C" functions throw exceptions
|
||||
@@ -324,4 +371,10 @@ if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4589") # Constructor of abstract class ... ignores initializer for virtual base class 'cv::Algorithm'
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4359") # Alignment specifier is less than actual alignment (4), and will be ignored
|
||||
endif()
|
||||
|
||||
if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
|
||||
string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -81,6 +81,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911)
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
@@ -302,16 +302,15 @@ macro(add_android_project target path)
|
||||
endif()
|
||||
|
||||
add_library(${JNI_LIB_NAME} SHARED ${android_proj_jni_files})
|
||||
target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
target_link_libraries(${JNI_LIB_NAME} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES
|
||||
OUTPUT_NAME "${JNI_LIB_NAME}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}"
|
||||
)
|
||||
|
||||
get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
|
||||
if (NOT (CMAKE_BUILD_TYPE MATCHES "debug"))
|
||||
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
|
||||
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "$<TARGET_FILE:${JNI_LIB_NAME}>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
# disabled because of multiple warnings during building nvcc auto generated files
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GCC_REGEX_VERSION VERSION_GREATER "4.6.0")
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.6.0")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,10 +14,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANGCC 1)
|
||||
endif()
|
||||
|
||||
if((CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC) AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
|
||||
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
|
||||
@@ -42,53 +38,15 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC AND CMAKE_C_COMPILER MATCHES "icc")
|
||||
if(MSVC AND CMAKE_C_COMPILER MATCHES "icc|icl")
|
||||
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect GNU version:
|
||||
# ----------------------------------------------------------------------------
|
||||
if(CMAKE_COMPILER_IS_CLANGCXX)
|
||||
set(CMAKE_GCC_REGEX_VERSION "4.2.1")
|
||||
set(CMAKE_OPENCV_GCC_VERSION_MAJOR 4)
|
||||
set(CMAKE_OPENCV_GCC_VERSION_MINOR 2)
|
||||
set(CMAKE_OPENCV_GCC_VERSION 42)
|
||||
set(CMAKE_OPENCV_GCC_VERSION_NUM 402)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v
|
||||
ERROR_VARIABLE CMAKE_OPENCV_CLANG_VERSION_FULL
|
||||
ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
string(REGEX MATCH "version.*$" CMAKE_OPENCV_CLANG_VERSION_FULL "${CMAKE_OPENCV_CLANG_VERSION_FULL}")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_CLANG_REGEX_VERSION "${CMAKE_OPENCV_CLANG_VERSION_FULL}")
|
||||
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -v
|
||||
ERROR_VARIABLE CMAKE_OPENCV_GCC_INFO_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Typical output in CMAKE_OPENCV_GCC_VERSION_FULL: "c+//0 (whatever) 4.2.3 (...)"
|
||||
# Look for the version number
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
|
||||
if(NOT CMAKE_GCC_REGEX_VERSION)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
|
||||
endif()
|
||||
|
||||
# Split the three parts:
|
||||
string(REGEX MATCHALL "[0-9]+" CMAKE_OPENCV_GCC_VERSIONS "${CMAKE_GCC_REGEX_VERSION}")
|
||||
|
||||
list(GET CMAKE_OPENCV_GCC_VERSIONS 0 CMAKE_OPENCV_GCC_VERSION_MAJOR)
|
||||
list(GET CMAKE_OPENCV_GCC_VERSIONS 1 CMAKE_OPENCV_GCC_VERSION_MINOR)
|
||||
|
||||
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
|
||||
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
|
||||
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
|
||||
if(NOT DEFINED CMAKE_CXX_COMPILER_VERSION)
|
||||
message(WARNING "Compiler version is not available: CMAKE_CXX_COMPILER_VERSION is not set")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
|
||||
@@ -142,6 +100,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911)
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
@@ -85,8 +85,6 @@ function(get_ipp_version _ROOT_DIR)
|
||||
message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]")
|
||||
message(STATUS "at: ${_ROOT_DIR}")
|
||||
|
||||
return()
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -129,8 +127,6 @@ function(set_ipp_old_libraries)
|
||||
${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
PARENT_SCOPE)
|
||||
|
||||
return()
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -173,7 +169,6 @@ function(set_ipp_new_libraries _LATEST_VERSION)
|
||||
${IPP_LIB_PREFIX}svml${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
return()
|
||||
|
||||
endfunction()
|
||||
|
||||
@@ -208,7 +203,7 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}")
|
||||
|
||||
else()
|
||||
elseif(${_LATEST_VERSION} VERSION_LESS "9.0")
|
||||
# message(STATUS "new")
|
||||
|
||||
# set INCLUDE and LIB folders
|
||||
@@ -229,7 +224,10 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH)
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../compiler/lib REALPATH)
|
||||
if(NOT EXISTS "${INTEL_COMPILER_LIBRARY_DIR}")
|
||||
get_filename_component(INTEL_COMPILER_LIBRARY_DIR ${IPP_ROOT_DIR}/../lib REALPATH)
|
||||
endif()
|
||||
if (IPP_X64)
|
||||
if(NOT EXISTS ${INTEL_COMPILER_LIBRARY_DIR}/intel64)
|
||||
message(SEND_ERROR "Intel compiler EM64T libraries not found")
|
||||
@@ -253,10 +251,11 @@ function(set_ipp_variables _LATEST_VERSION)
|
||||
set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
|
||||
message(STATUS "IPP libs: ${IPP_LIBRARIES}")
|
||||
|
||||
else()
|
||||
message(STATUS "IPP: version ${_LATEST_VERSION} is not supported (${IPP_ROOT_DIR})")
|
||||
set(IPP_FOUND 0 PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
return()
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
@@ -84,23 +84,16 @@ if(WITH_PVAPI)
|
||||
set(PVAPI_SDK_SUBDIR arm)
|
||||
endif()
|
||||
|
||||
get_filename_component(_PVAPI_LIBRARY "${PVAPI_INCLUDE_PATH}/../lib-pc" ABSOLUTE)
|
||||
if(PVAPI_SDK_SUBDIR)
|
||||
set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${PVAPI_SDK_SUBDIR}")
|
||||
endif()
|
||||
if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_OPENCV_GCC_VERSION_MAJOR}.${CMAKE_OPENCV_GCC_VERSION_MINOR}")
|
||||
endif()
|
||||
get_filename_component(_PVAPI_LIBRARY_HINT "${PVAPI_INCLUDE_PATH}/../lib-pc" ABSOLUTE)
|
||||
|
||||
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}")
|
||||
find_library(PVAPI_LIBRARY NAMES "PvAPI" PATHS "${_PVAPI_LIBRARY_HINT}")
|
||||
|
||||
if(PVAPI_LIBRARY)
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
set(PVAPI_DEFINITIONS "-DPVDECL=__stdcall")
|
||||
endif(MINGW)
|
||||
endif()
|
||||
set(HAVE_PVAPI TRUE)
|
||||
endif()
|
||||
endif(PVAPI_INCLUDE_PATH)
|
||||
@@ -190,63 +183,36 @@ if(WITH_XIMEA)
|
||||
endif(WITH_XIMEA)
|
||||
|
||||
# --- FFMPEG ---
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
ocv_clear_vars(HAVE_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
|
||||
elseif(UNIX)
|
||||
CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
|
||||
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
|
||||
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
|
||||
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
|
||||
CHECK_MODULE(libavresample HAVE_FFMPEG_RESAMPLE)
|
||||
|
||||
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
|
||||
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
|
||||
if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)
|
||||
if(EXISTS /usr/include/ffmpeg/libavformat/avformat.h OR HAVE_FFMPEG_SWSCALE)
|
||||
set(HAVE_GENTOO_FFMPEG TRUE)
|
||||
endif()
|
||||
set(HAVE_FFMPEG TRUE)
|
||||
elseif(PKG_CONFIG_FOUND)
|
||||
ocv_check_modules(FFMPEG libavcodec libavformat libavutil libswscale)
|
||||
ocv_check_modules(FFMPEG_libavresample libavresample)
|
||||
if(FFMPEG_libavresample_FOUND)
|
||||
ocv_append_build_options(FFMPEG FFMPEG_libavresample)
|
||||
endif()
|
||||
if(HAVE_FFMPEG_CODEC AND HAVE_FFMPEG_FORMAT AND HAVE_FFMPEG_UTIL AND HAVE_FFMPEG_SWSCALE)
|
||||
set(HAVE_FFMPEG TRUE)
|
||||
endif()
|
||||
|
||||
if(HAVE_FFMPEG)
|
||||
# Find the bzip2 library because it is required on some systems
|
||||
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)
|
||||
if(NOT BZIP2_LIBRARIES)
|
||||
# Do an other trial
|
||||
FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)
|
||||
try_compile(__VALID_FFMPEG
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/ffmpeg_test.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FFMPEG_INCLUDE_DIRS}"
|
||||
"-DLINK_DIRECTORIES:STRING=${FFMPEG_LIBRARY_DIRS}"
|
||||
"-DLINK_LIBRARIES:STRING=${FFMPEG_LIBRARIES}"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT __VALID_FFMPEG)
|
||||
#message(FATAL_ERROR "FFMPEG: test check build log:\n${TRY_OUT}")
|
||||
message(STATUS "WARNING: Can't build ffmpeg test code")
|
||||
set(HAVE_FFMPEG FALSE)
|
||||
else()
|
||||
ocv_append_build_options(HIGHGUI FFMPEG)
|
||||
endif()
|
||||
else()
|
||||
find_path(FFMPEG_INCLUDE_DIR "libavformat/avformat.h"
|
||||
PATHS /usr/local /usr /opt
|
||||
PATH_SUFFIXES include
|
||||
DOC "The path to FFMPEG headers")
|
||||
if(FFMPEG_INCLUDE_DIR)
|
||||
set(HAVE_GENTOO_FFMPEG TRUE)
|
||||
set(FFMPEG_LIB_DIR "${FFMPEG_INCLUDE_DIR}/../lib" CACHE PATH "Full path of FFMPEG library directory")
|
||||
find_library(FFMPEG_CODEC_LIB "avcodec" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_FORMAT_LIB "avformat" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_UTIL_LIB "avutil" HINTS "${FFMPEG_LIB_DIR}")
|
||||
find_library(FFMPEG_SWSCALE_LIB "swscale" HINTS "${FFMPEG_LIB_DIR}")
|
||||
if(FFMPEG_CODEC_LIB AND FFMPEG_FORMAT_LIB AND
|
||||
FFMPEG_UTIL_LIB AND FFMPEG_SWSCALE_LIB)
|
||||
set(ALIASOF_libavcodec_VERSION "Unknown")
|
||||
set(ALIASOF_libavformat_VERSION "Unknown")
|
||||
set(ALIASOF_libavutil_VERSION "Unknown")
|
||||
set(ALIASOF_libswscale_VERSION "Unknown")
|
||||
set(HAVE_FFMPEG 1)
|
||||
endif()
|
||||
endif(FFMPEG_INCLUDE_DIR)
|
||||
if(HAVE_FFMPEG)
|
||||
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES}
|
||||
${FFMPEG_CODEC_LIB} ${FFMPEG_FORMAT_LIB}
|
||||
${FFMPEG_UTIL_LIB} ${FFMPEG_SWSCALE_LIB})
|
||||
ocv_include_directories(${FFMPEG_INCLUDE_DIR})
|
||||
endif(HAVE_FFMPEG)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Can't find ffmpeg - 'pkg-config' utility is missing")
|
||||
endif()
|
||||
endif(WITH_FFMPEG)
|
||||
|
||||
@@ -273,19 +239,18 @@ if(WIN32)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
# --- Apple AV Foundation ---
|
||||
if(WITH_AVFOUNDATION)
|
||||
set(HAVE_AVFOUNDATION YES)
|
||||
endif()
|
||||
|
||||
# --- QuickTime ---
|
||||
if (NOT IOS)
|
||||
if(WITH_QUICKTIME)
|
||||
set(HAVE_QUICKTIME YES)
|
||||
elseif(APPLE)
|
||||
set(HAVE_QTKIT YES)
|
||||
if(APPLE)
|
||||
if(WITH_AVFOUNDATION)
|
||||
set(HAVE_AVFOUNDATION YES)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT IOS)
|
||||
if(WITH_QUICKTIME)
|
||||
set(HAVE_QUICKTIME YES)
|
||||
elseif(WITH_QTKIT)
|
||||
set(HAVE_QTKIT YES)
|
||||
endif()
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
# --- Intel Perceptual Computing SDK ---
|
||||
if(WITH_INTELPERC)
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
#
|
||||
# OpenCV note: the file has been extracted from CMake 2.6.2 distribution.
|
||||
# It is used to build OpenCV with CMake 2.4.x
|
||||
#
|
||||
|
||||
# - a pkg-config module for CMake
|
||||
#
|
||||
# Usage:
|
||||
# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
|
||||
# checks for all the given modules
|
||||
#
|
||||
# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
|
||||
# checks for given modules and uses the first working one
|
||||
#
|
||||
# When the 'REQUIRED' argument was set, macros will fail with an error
|
||||
# when module(s) could not be found
|
||||
#
|
||||
# It sets the following variables:
|
||||
# PKG_CONFIG_FOUND ... true if pkg-config works on the system
|
||||
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
|
||||
# <PREFIX>_FOUND ... set to 1 if module(s) exist
|
||||
#
|
||||
# For the following variables two sets of values exist; first one is the
|
||||
# common one and has the given PREFIX. The second set contains flags
|
||||
# which are given out when pkgconfig was called with the '--static'
|
||||
# option.
|
||||
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
|
||||
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
|
||||
# <XPREFIX>_LDFLAGS ... all required linker flags
|
||||
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
|
||||
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
|
||||
# <XPREFIX>_CFLAGS ... all required cflags
|
||||
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
|
||||
#
|
||||
# <XPREFIX> = <PREFIX> for common case
|
||||
# <XPREFIX> = <PREFIX>_STATIC for static linking
|
||||
#
|
||||
# There are some special variables whose prefix depends on the count
|
||||
# of given modules. When there is only one module, <PREFIX> stays
|
||||
# unchanged. When there are multiple modules, the prefix will be
|
||||
# changed to <PREFIX>_<MODNAME>:
|
||||
# <XPREFIX>_VERSION ... version of the module
|
||||
# <XPREFIX>_PREFIX ... prefix-directory of the module
|
||||
# <XPREFIX>_INCLUDEDIR ... include-dir of the module
|
||||
# <XPREFIX>_LIBDIR ... lib-dir of the module
|
||||
#
|
||||
# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
|
||||
# <XPREFIX> = <PREFIX>_<MODNAME>
|
||||
#
|
||||
# A <MODULE> parameter can have the following formats:
|
||||
# {MODNAME} ... matches any version
|
||||
# {MODNAME}>={VERSION} ... at least version <VERSION> is required
|
||||
# {MODNAME}={VERSION} ... exactly version <VERSION> is required
|
||||
# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
|
||||
#
|
||||
# Examples
|
||||
# pkg_check_modules (GLIB2 glib-2.0)
|
||||
#
|
||||
# pkg_check_modules (GLIB2 glib-2.0>=2.10)
|
||||
# requires at least version 2.10 of glib2 and defines e.g.
|
||||
# GLIB2_VERSION=2.10.3
|
||||
#
|
||||
# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
|
||||
# requires both glib2 and gtk2, and defines e.g.
|
||||
# FOO_glib-2.0_VERSION=2.10.3
|
||||
# FOO_gtk+-2.0_VERSION=2.8.20
|
||||
#
|
||||
# pkg_check_modules (XRENDER REQUIRED xrender)
|
||||
# defines e.g.:
|
||||
# XRENDER_LIBRARIES=Xrender;X11
|
||||
# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
|
||||
#
|
||||
# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
|
||||
|
||||
|
||||
# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
#
|
||||
# Redistribution and use, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# 2. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
|
||||
|
||||
### Common stuff ####
|
||||
set(PKG_CONFIG_VERSION 1)
|
||||
set(PKG_CONFIG_FOUND 0)
|
||||
|
||||
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
|
||||
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
if(PKG_CONFIG_EXECUTABLE)
|
||||
set(PKG_CONFIG_FOUND 1)
|
||||
endif(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
|
||||
# Unsets the given variables
|
||||
macro(_pkgconfig_unset var)
|
||||
set(${var} "" CACHE INTERNAL "")
|
||||
endmacro(_pkgconfig_unset)
|
||||
|
||||
macro(_pkgconfig_set var value)
|
||||
set(${var} ${value} CACHE INTERNAL "")
|
||||
endmacro(_pkgconfig_set)
|
||||
|
||||
# Invokes pkgconfig, cleans up the result and sets variables
|
||||
macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
|
||||
set(_pkgconfig_invoke_result)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
|
||||
OUTPUT_VARIABLE _pkgconfig_invoke_result
|
||||
RESULT_VARIABLE _pkgconfig_failed)
|
||||
|
||||
if (_pkgconfig_failed)
|
||||
set(_pkgconfig_${_varname} "")
|
||||
_pkgconfig_unset(${_prefix}_${_varname})
|
||||
else(_pkgconfig_failed)
|
||||
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
|
||||
string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
|
||||
|
||||
if (NOT ${_regexp} STREQUAL "")
|
||||
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
|
||||
endif(NOT ${_regexp} STREQUAL "")
|
||||
|
||||
separate_arguments(_pkgconfig_invoke_result)
|
||||
|
||||
#message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
|
||||
set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
|
||||
_pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
|
||||
endif(_pkgconfig_failed)
|
||||
endmacro(_pkgconfig_invoke)
|
||||
|
||||
# Invokes pkgconfig two times; once without '--static' and once with
|
||||
# '--static'
|
||||
macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
|
||||
_pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN})
|
||||
_pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN})
|
||||
endmacro(_pkgconfig_invoke_dyn)
|
||||
|
||||
# Splits given arguments into options and a package list
|
||||
macro(_pkgconfig_parse_options _result _is_req)
|
||||
set(${_is_req} 0)
|
||||
|
||||
foreach(_pkg ${ARGN})
|
||||
if (_pkg STREQUAL "REQUIRED")
|
||||
set(${_is_req} 1)
|
||||
endif (_pkg STREQUAL "REQUIRED")
|
||||
endforeach(_pkg ${ARGN})
|
||||
|
||||
set(${_result} ${ARGN})
|
||||
list(REMOVE_ITEM ${_result} "REQUIRED")
|
||||
endmacro(_pkgconfig_parse_options)
|
||||
|
||||
###
|
||||
macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
|
||||
_pkgconfig_unset(${_prefix}_FOUND)
|
||||
_pkgconfig_unset(${_prefix}_VERSION)
|
||||
_pkgconfig_unset(${_prefix}_PREFIX)
|
||||
_pkgconfig_unset(${_prefix}_INCLUDEDIR)
|
||||
_pkgconfig_unset(${_prefix}_LIBDIR)
|
||||
_pkgconfig_unset(${_prefix}_LIBS)
|
||||
_pkgconfig_unset(${_prefix}_LIBS_L)
|
||||
_pkgconfig_unset(${_prefix}_LIBS_PATHS)
|
||||
_pkgconfig_unset(${_prefix}_LIBS_OTHER)
|
||||
_pkgconfig_unset(${_prefix}_CFLAGS)
|
||||
_pkgconfig_unset(${_prefix}_CFLAGS_I)
|
||||
_pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_LIBS)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
|
||||
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
|
||||
|
||||
# create a better addressable variable of the modules and calculate its size
|
||||
set(_pkg_check_modules_list ${ARGN})
|
||||
list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
|
||||
|
||||
if(PKG_CONFIG_EXECUTABLE)
|
||||
# give out status message telling checked module
|
||||
if (NOT ${_is_silent})
|
||||
if (_pkg_check_modules_cnt EQUAL 1)
|
||||
message(STATUS "checking for module '${_pkg_check_modules_list}'")
|
||||
else(_pkg_check_modules_cnt EQUAL 1)
|
||||
message(STATUS "checking for modules '${_pkg_check_modules_list}'")
|
||||
endif(_pkg_check_modules_cnt EQUAL 1)
|
||||
endif(NOT ${_is_silent})
|
||||
|
||||
set(_pkg_check_modules_packages)
|
||||
set(_pkg_check_modules_failed)
|
||||
|
||||
# iterate through module list and check whether they exist and match the required version
|
||||
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
|
||||
set(_pkg_check_modules_exist_query)
|
||||
|
||||
# check whether version is given
|
||||
if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
|
||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
|
||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
|
||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
|
||||
else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
|
||||
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
|
||||
set(_pkg_check_modules_pkg_op)
|
||||
set(_pkg_check_modules_pkg_ver)
|
||||
endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
|
||||
|
||||
# handle the operands
|
||||
if (_pkg_check_modules_pkg_op STREQUAL ">=")
|
||||
list(APPEND _pkg_check_modules_exist_query --atleast-version)
|
||||
endif(_pkg_check_modules_pkg_op STREQUAL ">=")
|
||||
|
||||
if (_pkg_check_modules_pkg_op STREQUAL "=")
|
||||
list(APPEND _pkg_check_modules_exist_query --exact-version)
|
||||
endif(_pkg_check_modules_pkg_op STREQUAL "=")
|
||||
|
||||
if (_pkg_check_modules_pkg_op STREQUAL "<=")
|
||||
list(APPEND _pkg_check_modules_exist_query --max-version)
|
||||
endif(_pkg_check_modules_pkg_op STREQUAL "<=")
|
||||
|
||||
# create the final query which is of the format:
|
||||
# * --atleast-version <version> <pkg-name>
|
||||
# * --exact-version <version> <pkg-name>
|
||||
# * --max-version <version> <pkg-name>
|
||||
# * --exists <pkg-name>
|
||||
if (_pkg_check_modules_pkg_op)
|
||||
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
|
||||
else(_pkg_check_modules_pkg_op)
|
||||
list(APPEND _pkg_check_modules_exist_query --exists)
|
||||
endif(_pkg_check_modules_pkg_op)
|
||||
|
||||
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
|
||||
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
|
||||
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
|
||||
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
|
||||
|
||||
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
|
||||
list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
|
||||
|
||||
# execute the query
|
||||
execute_process(
|
||||
COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
|
||||
RESULT_VARIABLE _pkgconfig_retval)
|
||||
|
||||
# evaluate result and tell failures
|
||||
if (_pkgconfig_retval)
|
||||
if(NOT ${_is_silent})
|
||||
message(STATUS " package '${_pkg_check_modules_pkg}' not found")
|
||||
endif(NOT ${_is_silent})
|
||||
|
||||
set(_pkg_check_modules_failed 1)
|
||||
endif(_pkgconfig_retval)
|
||||
endforeach(_pkg_check_modules_pkg)
|
||||
|
||||
if(_pkg_check_modules_failed)
|
||||
# fail when requested
|
||||
if (${_is_required})
|
||||
message(SEND_ERROR "A required package was not found")
|
||||
endif (${_is_required})
|
||||
else(_pkg_check_modules_failed)
|
||||
# when we are here, we checked whether requested modules
|
||||
# exist. Now, go through them and set variables
|
||||
|
||||
_pkgconfig_set(${_prefix}_FOUND 1)
|
||||
list(LENGTH _pkg_check_modules_packages pkg_count)
|
||||
|
||||
# iterate through all modules again and set individual variables
|
||||
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
|
||||
# handle case when there is only one package required
|
||||
if (pkg_count EQUAL 1)
|
||||
set(_pkg_check_prefix "${_prefix}")
|
||||
else(pkg_count EQUAL 1)
|
||||
set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
|
||||
endif(pkg_count EQUAL 1)
|
||||
|
||||
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
|
||||
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
|
||||
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
|
||||
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
|
||||
|
||||
message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
|
||||
endforeach(_pkg_check_modules_pkg)
|
||||
|
||||
# set variables which are combined for multiple modules
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
|
||||
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
|
||||
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
|
||||
endif(_pkg_check_modules_failed)
|
||||
else(PKG_CONFIG_EXECUTABLE)
|
||||
if (${_is_required})
|
||||
message(SEND_ERROR "pkg-config tool not found")
|
||||
endif (${_is_required})
|
||||
endif(PKG_CONFIG_EXECUTABLE)
|
||||
endmacro(_pkg_check_modules_internal)
|
||||
|
||||
###
|
||||
### User visible macros start here
|
||||
###
|
||||
|
||||
###
|
||||
macro(pkg_check_modules _prefix _module0)
|
||||
# check cached value
|
||||
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
|
||||
_pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
|
||||
_pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
|
||||
|
||||
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
|
||||
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
|
||||
endmacro(pkg_check_modules)
|
||||
|
||||
###
|
||||
macro(pkg_search_module _prefix _module0)
|
||||
# check cached value
|
||||
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
|
||||
set(_pkg_modules_found 0)
|
||||
_pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
|
||||
|
||||
message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
|
||||
|
||||
# iterate through all modules and stop at the first working one.
|
||||
foreach(_pkg_alt ${_pkg_modules_alt})
|
||||
if(NOT _pkg_modules_found)
|
||||
_pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
|
||||
endif(NOT _pkg_modules_found)
|
||||
|
||||
if (${_prefix}_FOUND)
|
||||
set(_pkg_modules_found 1)
|
||||
endif(${_prefix}_FOUND)
|
||||
endforeach(_pkg_alt)
|
||||
|
||||
if (NOT ${_prefix}_FOUND)
|
||||
if(${_pkg_is_required})
|
||||
message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
|
||||
endif(${_pkg_is_required})
|
||||
endif(NOT ${_prefix}_FOUND)
|
||||
|
||||
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
|
||||
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
|
||||
endmacro(pkg_search_module)
|
||||
|
||||
### Local Variables:
|
||||
### mode: cmake
|
||||
### End:
|
||||
@@ -46,16 +46,16 @@ endif()
|
||||
set(OpenCV_LIB_COMPONENTS_)
|
||||
foreach(CVLib ${OpenCV_LIB_COMPONENTS})
|
||||
|
||||
get_target_property(libloc ${CVLib} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
if(libloc MATCHES "3rdparty")
|
||||
set(libpath "\${exec_prefix}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}")
|
||||
else()
|
||||
set(libpath "\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
get_target_property(libname ${CVLib} OUTPUT_NAME_${CMAKE_BUILD_TYPE})
|
||||
if(NOT libname)
|
||||
get_target_property(libname ${CVLib} OUTPUT_NAME)
|
||||
endif()
|
||||
if(NOT libname)
|
||||
set(libname "${CVLib}")
|
||||
endif()
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libpath}")
|
||||
|
||||
get_filename_component(libname ${CVLib} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" libname "${libname}")
|
||||
set(libpath "\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libpath}")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${libname}")
|
||||
|
||||
endforeach()
|
||||
@@ -66,7 +66,7 @@ if(OpenCV_EXTRA_COMPONENTS)
|
||||
if(TARGET "${extra_component}")
|
||||
get_target_property(extra_component_is_imported "${extra_component}" IMPORTED)
|
||||
if(extra_component_is_imported)
|
||||
get_target_property(extra_component "${extra_component}" LOCATION)
|
||||
get_target_property(extra_component "${extra_component}" IMPORTED_LOCATION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -74,8 +74,8 @@ if(OpenCV_EXTRA_COMPONENTS)
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "${extra_component}")
|
||||
elseif(extra_component MATCHES "[\\/]")
|
||||
get_filename_component(libdir "${extra_component}" PATH)
|
||||
get_filename_component(libname "${extra_component}" NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" libname "${libname}")
|
||||
get_filename_component(libname "${extra_component}" NAME)
|
||||
ocv_get_libname(libname "${libname}")
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}" "-l${libname}")
|
||||
else()
|
||||
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${extra_component}")
|
||||
|
||||
@@ -170,6 +170,10 @@ macro(ocv_add_module _name)
|
||||
return() # extra protection from redefinition
|
||||
endif()
|
||||
project(${the_module})
|
||||
add_definitions(
|
||||
-D_USE_MATH_DEFINES # M_PI constant in MSVS
|
||||
-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS # to use C libraries from C++ code (ffmpeg)
|
||||
)
|
||||
endif(OPENCV_INITIAL_PASS)
|
||||
endmacro()
|
||||
|
||||
@@ -574,12 +578,12 @@ macro(ocv_create_module)
|
||||
${${the_module}_pch})
|
||||
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
|
||||
target_link_libraries(${the_module} ${extra_deps})
|
||||
target_link_libraries(${the_module} LINK_PRIVATE ${_simple_deps}) # this list goes to "export"
|
||||
target_link_libraries(${the_module} LINK_PRIVATE ${extra_deps})
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@@ -591,7 +595,10 @@ macro(ocv_create_module)
|
||||
set_target_properties(${the_module} PROPERTIES
|
||||
OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME "${the_module}${OPENCV_DLLVERSION}"
|
||||
COMPILE_PDB_NAME_DEBUG "${the_module}${OPENCV_DLLVERSION}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
@@ -14,12 +14,7 @@
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
EXEC_PROGRAM(
|
||||
${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
|
||||
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2.0")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
@@ -74,6 +69,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
item MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
@@ -83,6 +81,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
FOREACH(item ${DIRINC})
|
||||
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
item MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
|
||||
endif()
|
||||
|
||||
@@ -124,7 +124,7 @@ set(STD_OPENCV_DEV libopencv-dev)
|
||||
|
||||
set(ABI_VERSION_SUFFIX "")
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(${CMAKE_OPENCV_GCC_VERSION_MAJOR} EQUAL 5)
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)
|
||||
set(ABI_VERSION_SUFFIX "v5")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+147
-23
@@ -1,5 +1,12 @@
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation thess macro should be defined by toolchain file
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig)
|
||||
endif()
|
||||
|
||||
# Search packages for the host system instead of packages for target system
|
||||
# in case of cross compilation these macros should be defined by the toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
@@ -11,6 +18,47 @@ if(NOT COMMAND find_host_program)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(NOT COMMAND cmake_parse_arguments)
|
||||
include(CMakeParseArguments OPTIONAL) # CMake 2.8.3+
|
||||
endif()
|
||||
|
||||
# Debugging function
|
||||
function(ocv_cmake_dump_vars)
|
||||
set(VARS "")
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
if(COMMAND cmake_parse_arguments222)
|
||||
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
|
||||
set(regex "${DUMP_UNPARSED_ARGUMENTS}")
|
||||
else()
|
||||
set(regex "${ARGV0}")
|
||||
if(ARGV1 STREQUAL "TOFILE")
|
||||
set(DUMP_TOFILE "${ARGV2}")
|
||||
endif()
|
||||
endif()
|
||||
string(TOLOWER "${regex}" regex_lower)
|
||||
foreach(_variableName ${_variableNames})
|
||||
string(TOLOWER "${_variableName}" _variableName_lower)
|
||||
if(_variableName MATCHES "${regex}" OR _variableName_lower MATCHES "${regex_lower}")
|
||||
set(VARS "${VARS}${_variableName}=${${_variableName}}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
if(DUMP_TOFILE)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${VARS}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "${VARS}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_cmake_eval var_name)
|
||||
if(DEFINED ${var_name})
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CMakeCommand-${var_name}.cmake" ${${var_name}})
|
||||
include("${CMAKE_BINARY_DIR}/CMakeCommand-${var_name}.cmake")
|
||||
endif()
|
||||
if(";${ARGN};" MATCHES ";ONCE;")
|
||||
unset(${var_name} CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# assert macro
|
||||
# Note: it doesn't support lists in arguments
|
||||
# Usage samples:
|
||||
@@ -34,13 +82,16 @@ macro(ocv_check_environment_variables)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
# adds include directories in such a way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
set(__add_before "")
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
|
||||
list(APPEND __add_before "${dir}")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
dir MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
include_directories(AFTER SYSTEM "${dir}")
|
||||
endif()
|
||||
@@ -66,7 +117,7 @@ set(OCV_COMPILER_FAIL_REGEX
|
||||
"[Uu]nknown option" # HP
|
||||
"[Ww]arning: [Oo]ption" # SunPro
|
||||
"command option .* is not recognized" # XL
|
||||
"not supported in this configuration; ignored" # AIX
|
||||
"not supported in this configuration, ignored" # AIX (';' is replaced with ',')
|
||||
"File with unknown suffix passed to linker" # PGI
|
||||
"WARNING: unknown flag:" # Open64
|
||||
)
|
||||
@@ -105,12 +156,25 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
|
||||
COMPILE_DEFINITIONS "${FLAG}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
|
||||
IF("${OUTPUT}" MATCHES "${_regex}")
|
||||
SET(${RESULT} 0)
|
||||
break()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
if(${RESULT})
|
||||
string(REPLACE ";" "," OUTPUT_LINES "${OUTPUT}")
|
||||
string(REPLACE "\n" ";" OUTPUT_LINES "${OUTPUT_LINES}")
|
||||
foreach(_regex ${OCV_COMPILER_FAIL_REGEX})
|
||||
if(NOT ${RESULT})
|
||||
break()
|
||||
endif()
|
||||
foreach(_line ${OUTPUT_LINES})
|
||||
if("${_line}" MATCHES "${_regex}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Build output check failed:\n"
|
||||
" Regex: '${_regex}'\n"
|
||||
" Output line: '${_line}'\n")
|
||||
set(${RESULT} 0)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
IF(${RESULT})
|
||||
SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
|
||||
@@ -118,6 +182,13 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
|
||||
ELSE(${RESULT})
|
||||
MESSAGE(STATUS "Performing Test ${RESULT} - Failed")
|
||||
SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Compilation failed:\n"
|
||||
" source file: '${_fname}'\n"
|
||||
" check option: '${FLAG}'\n"
|
||||
"===== BUILD LOG =====\n"
|
||||
"${OUTPUT}\n"
|
||||
"===== END =====\n\n")
|
||||
ENDIF(${RESULT})
|
||||
else()
|
||||
SET(${RESULT} 0)
|
||||
@@ -227,8 +298,46 @@ macro(OCV_OPTION variable description value)
|
||||
unset(__value)
|
||||
endmacro()
|
||||
|
||||
# Usage: ocv_append_build_options(HIGHGUI FFMPEG)
|
||||
macro(ocv_append_build_options var_prefix pkg_prefix)
|
||||
foreach(suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS)
|
||||
if(${pkg_prefix}_${suffix})
|
||||
list(APPEND ${var_prefix}_${suffix} ${${pkg_prefix}_${suffix}})
|
||||
list(REMOVE_DUPLICATES ${var_prefix}_${suffix})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Macros that checks if module have been installed.
|
||||
# Usage is similar to CMake 'pkg_check_modules' command
|
||||
# It additionally controls HAVE_${define} and ${define}_${modname}_FOUND variables
|
||||
macro(ocv_check_modules define)
|
||||
unset(HAVE_${define})
|
||||
foreach(m ${ARGN})
|
||||
if (m MATCHES "(.*[^><])(>=|=|<=)(.*)")
|
||||
set(__modname "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(__modname "${m}")
|
||||
endif()
|
||||
unset(${define}_${__modname}_FOUND)
|
||||
endforeach()
|
||||
pkg_check_modules(${define} ${ARGN})
|
||||
if(${define}_FOUND)
|
||||
set(HAVE_${define} 1)
|
||||
endif()
|
||||
foreach(m ${ARGN})
|
||||
if (m MATCHES "(.*[^><])(>=|=|<=)(.*)")
|
||||
set(__modname "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(__modname "${m}")
|
||||
endif()
|
||||
if(NOT DEFINED ${define}_${__modname}_FOUND AND ${define}_FOUND)
|
||||
set(${define}_${__modname}_FOUND 1)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Macro that checks if module has been installed.
|
||||
# After it adds module to build and define
|
||||
# constants passed as second arg
|
||||
macro(CHECK_MODULE module_name define)
|
||||
@@ -417,7 +526,7 @@ macro(ocv_list_add_suffix LST SUFFIX)
|
||||
endmacro()
|
||||
|
||||
|
||||
# gets and removes the first element from list
|
||||
# gets and removes the first element from the list
|
||||
macro(ocv_list_pop_front LST VAR)
|
||||
if(${LST})
|
||||
list(GET ${LST} 0 ${VAR})
|
||||
@@ -498,8 +607,11 @@ function(ocv_install_target)
|
||||
set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
if(MSVS)
|
||||
if(NOT INSTALL_IGNORE_PDB AND
|
||||
(INSTALL_PDB OR
|
||||
(INSTALL_CREATE_DISTRIB AND NOT BUILD_SHARED_LIBS)
|
||||
))
|
||||
set(__target "${ARGV0}")
|
||||
|
||||
set(isArchive 0)
|
||||
@@ -522,16 +634,22 @@ function(ocv_install_target)
|
||||
|
||||
# message(STATUS "Process ${__target} dst=${__dst}...")
|
||||
if(DEFINED __dst)
|
||||
get_target_property(fname ${__target} LOCATION_DEBUG)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
|
||||
endif()
|
||||
# If CMake version is >=3.1.0 or <2.8.12.
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.1.0 OR CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
get_target_property(fname ${__target} LOCATION_DEBUG)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Debug OPTIONAL)
|
||||
endif()
|
||||
|
||||
get_target_property(fname ${__target} LOCATION_RELEASE)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
|
||||
get_target_property(fname ${__target} LOCATION_RELEASE)
|
||||
if(fname MATCHES "\\.lib$")
|
||||
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
|
||||
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Release OPTIONAL)
|
||||
endif()
|
||||
else()
|
||||
# CMake 2.8.12 broke PDB support for STATIC libraries from MSVS, fix was introduced in CMake 3.1.0.
|
||||
message(WARNING "PDB's are not supported from this version of CMake, use CMake version later then 3.1.0 or before 2.8.12.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -631,6 +749,12 @@ function(ocv_source_group group)
|
||||
source_group(${group} FILES ${srcs})
|
||||
endfunction()
|
||||
|
||||
macro(ocv_get_libname var_name)
|
||||
get_filename_component(__libname "${ARGN}" NAME)
|
||||
string(REGEX REPLACE "^lib(.+).(a|so)(.[.0-9]+)?$" "\\1" __libname "${__libname}")
|
||||
set(${var_name} "${__libname}")
|
||||
endmacro()
|
||||
|
||||
# build the list of simple dependencies, that links via "-l"
|
||||
# _all_libs - name of variable with input list
|
||||
# _simple - name of variable with output list of simple libs
|
||||
|
||||
@@ -14,6 +14,6 @@ endif()
|
||||
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
||||
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
|
||||
# create a dependency on version file
|
||||
# we never use output of the following command but cmake will rerun automatically if the version file changes
|
||||
# create a dependency on the version file
|
||||
# we never use the output of the following command but cmake will rerun automatically if the version file changes
|
||||
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
|
||||
|
||||
static void test()
|
||||
{
|
||||
AVFormatContext* c = 0;
|
||||
AVCodec* avcodec = 0;
|
||||
AVFrame* frame = 0;
|
||||
|
||||
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
|
||||
int err = avformat_open_input(&c, "", NULL, NULL);
|
||||
#else
|
||||
int err = av_open_input_file(&c, "", NULL, 0, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main() { test(); return 0; }
|
||||
@@ -219,6 +219,14 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
||||
set(${__cvcomponent}_FOUND 1)
|
||||
endif()
|
||||
# OpenCV supports Debug and Release only.
|
||||
# RelWithDebInfo and MinSizeRel are mapped to Release
|
||||
if(TARGET ${__cvcomponent})
|
||||
set_target_properties(${__cvcomponent} PROPERTIES
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL "Release"
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
|
||||
|
||||
|
||||
@@ -61,12 +61,6 @@
|
||||
/* FFMpeg video library */
|
||||
#cmakedefine HAVE_FFMPEG
|
||||
|
||||
/* ffmpeg's libswscale */
|
||||
#cmakedefine HAVE_FFMPEG_SWSCALE
|
||||
|
||||
/* ffmpeg in Gentoo */
|
||||
#cmakedefine HAVE_GENTOO_FFMPEG
|
||||
|
||||
/* GStreamer multimedia framework */
|
||||
#cmakedefine HAVE_GSTREAMER
|
||||
|
||||
|
||||
+13
-1
@@ -49,7 +49,7 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
function(ocv_doc_add_file_to_fake_root source destination)
|
||||
add_custom_command(
|
||||
OUTPUT "${DOC_FAKE_ROOT}/${destination}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${source}" "${DOC_FAKE_ROOT}/${destination}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${source}" "${DOC_FAKE_ROOT}/${destination}"
|
||||
DEPENDS "${source}"
|
||||
COMMENT "Copying ${destination} to fake root..."
|
||||
VERBATIM
|
||||
@@ -184,4 +184,16 @@ if(HAVE_DOC_GENERATOR)
|
||||
foreach(f ${OPTIONAL_DOC_LIST})
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL COMPONENT docs)
|
||||
endforeach()
|
||||
|
||||
# Alias to build/install docs only
|
||||
set(__deps "")
|
||||
foreach(target docs html_docs doxygen)
|
||||
if(TARGET ${target})
|
||||
list(APPEND __deps ${target})
|
||||
endif()
|
||||
endforeach()
|
||||
add_custom_target(install_docs
|
||||
DEPENDS ${__deps}
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=docs -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
endif(HAVE_DOC_GENERATOR)
|
||||
|
||||
@@ -111,7 +111,7 @@ Then the PSNR is expressed as:
|
||||
|
||||
PSNR = 10 \cdot \log_{10} \left( \frac{MAX_I^2}{MSE} \right)
|
||||
|
||||
Here the :math:`MAX_I^2` is the maximum valid value for a pixel. In case of the simple single byte image per pixel per channel this is 255. When two images are the same the MSE will give zero, resulting in an invalid divide by zero operation in the PSNR formula. In this case the PSNR is undefined and as we'll need to handle this case separately. The transition to a logarithmic scale is made because the pixel values have a very wide dynamic range. All this translated to OpenCV and a C++ function looks like:
|
||||
Here the :math:`MAX_I` is the maximum valid value for a pixel. In case of the simple single byte image per pixel per channel this is 255. When two images are the same the MSE will give zero, resulting in an invalid divide by zero operation in the PSNR formula. In this case the PSNR is undefined and as we'll need to handle this case separately. The transition to a logarithmic scale is made because the pixel values have a very wide dynamic range. All this translated to OpenCV and a C++ function looks like:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -53,6 +53,14 @@ Dilation
|
||||
|
||||
The background (bright) dilates around the black regions of the letter.
|
||||
|
||||
To better grasp the idea and avoid possible confusion, in this another example we have inverted the original image such as the object in white is now the letter. We have performed two dilatations with a rectangular structuring element of size :math:`3x3`.
|
||||
|
||||
.. image:: images/Morphology_1_Tutorial_Theory_Dilatation_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting dilatation
|
||||
:align: center
|
||||
|
||||
The dilatation makes the object in white bigger.
|
||||
|
||||
Erosion
|
||||
^^^^^^^^
|
||||
|
||||
@@ -66,6 +74,13 @@ Erosion
|
||||
:alt: Erosion result - Theory example
|
||||
:align: center
|
||||
|
||||
In the same manner, the corresponding image resulting of the erosion operation on the inverted original image (two erosions with a rectangular structuring element of size :math:`3x3`.
|
||||
|
||||
.. image:: images/Morphology_1_Tutorial_Theory_Erosion_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting erosion
|
||||
:align: center
|
||||
|
||||
The erosion makes the object in white smaller.
|
||||
|
||||
Code
|
||||
======
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -31,7 +31,7 @@ In the previous tutorial we covered two basic Morphology operations:
|
||||
* Erosion
|
||||
* Dilation.
|
||||
|
||||
Based on these two we can effectuate more sophisticated transformations to our images. Here we discuss briefly 05 operations offered by OpenCV:
|
||||
Based on these two we can effectuate more sophisticated transformations to our images. Here we discuss briefly 5 operations offered by OpenCV:
|
||||
|
||||
Opening
|
||||
---------
|
||||
@@ -50,6 +50,12 @@ Opening
|
||||
:alt: Opening
|
||||
:align: center
|
||||
|
||||
For the sake of clarity, we have performed the opening operation (:math:`7x7` rectangular structuring element) on the same original image but inverted such as the object in white is now the letter.
|
||||
|
||||
.. image:: images/Morphology_2_Tutorial_Theory_Opening_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting opening
|
||||
:align: center
|
||||
|
||||
Closing
|
||||
---------
|
||||
|
||||
@@ -65,6 +71,11 @@ Closing
|
||||
:alt: Closing example
|
||||
:align: center
|
||||
|
||||
On the inverted image, we have performed the closing operation (:math:`7x7` rectangular structuring element):
|
||||
|
||||
.. image:: images/Morphology_2_Tutorial_Theory_Closing_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting closing
|
||||
:align: center
|
||||
|
||||
Morphological Gradient
|
||||
------------------------
|
||||
|
||||
@@ -81,4 +81,6 @@ Building OpenCV from Source Using CMake, Using the Command Line
|
||||
|
||||
.. note::
|
||||
|
||||
Use ``cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local ..`` , without spaces after -D if step 2 do not work.
|
||||
|
||||
If the size of the created library is a critical issue (like in case of an Android build) you can use the ``install/strip`` command to get the smallest size as possible. The *stripped* version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.
|
||||
|
||||
@@ -70,8 +70,12 @@ Building the OpenCV library from scratch requires a couple of tools installed be
|
||||
.. _CUDA_Toolkit: http://developer.nvidia.com/cuda-downloads
|
||||
.. |OpenEXR| replace:: OpenEXR
|
||||
.. _OpenEXR: http://www.openexr.com/downloads.html
|
||||
.. |OpenNI_Framework| replace:: OpenNI Framework
|
||||
.. _OpenNI_Framework: http://www.openni.org/
|
||||
.. |OpenNI_prebuilt| replace:: OpenNI prebuilt binaries
|
||||
.. _OpenNI_prebuilt: http://structure.io/openni
|
||||
.. |OpenNI_github| replace:: OpenNI Github
|
||||
.. _OpenNI_github: https://github.com/OpenNI/OpenNI
|
||||
.. |OpenNI2_github| replace:: OpenNI2 Github
|
||||
.. _OpenNI2_github: https://github.com/OpenNI/OpenNI2
|
||||
.. |Miktex| replace:: Miktex
|
||||
.. _Miktex: http://miktex.org/2.9/setup
|
||||
.. |Sphinx| replace:: Sphinx
|
||||
@@ -105,7 +109,7 @@ OpenCV may come in multiple flavors. There is a "core" section that will work on
|
||||
|
||||
+ |OpenEXR|_ source files are required for the library to work with this high dynamic range (HDR) image file format.
|
||||
|
||||
+ The |OpenNI_Framework|_ contains a set of open source APIs that provide support for natural interaction with devices via methods such as voice command recognition, hand gestures and body motion tracking.
|
||||
+ The OpenNI Framework contains a set of open source APIs that provide support for natural interaction with devices via methods such as voice command recognition, hand gestures and body motion tracking. |OpenNI_prebuilt|_ , |OpenNI_github|_ code and |OpenNI2_github|_ code is available.
|
||||
|
||||
+ |Miktex|_ is the best `TEX <https://secure.wikimedia.org/wikipedia/en/wiki/TeX>`_ implementation on the Windows OS. It is required to build the *OpenCV documentation*.
|
||||
|
||||
@@ -172,7 +176,7 @@ Building the library
|
||||
|
||||
#) Same as above with |OpenEXR|_.
|
||||
|
||||
#) For the |OpenNI_Framework|_ you need to install both the `development build <http://www.openni.org/downloadfiles/opennimodules/openni-binaries/21-stable>`_ and the `PrimeSensor Module <http://www.openni.org/downloadfiles/opennimodules/openni-compliant-hardware-binaries/32-stable>`_.
|
||||
#) For the |OpenNI_prebuilt|_ you need to install both the `development build <http://www.openni.org/downloadfiles/opennimodules/openni-binaries/21-stable>`_ and the `PrimeSensor Module <http://www.openni.org/downloadfiles/opennimodules/openni-compliant-hardware-binaries/32-stable>`_.
|
||||
|
||||
#) For the CUDA you need again two modules: the latest |CUDA_Toolkit|_ and the *CUDA Tools SDK*. Download and install both of them with a *complete* option by using the 32 or 64 bit setups according to your OS.
|
||||
|
||||
|
||||
@@ -83,7 +83,14 @@ is extended as:
|
||||
:math:`k_6` are radial distortion coefficients.
|
||||
:math:`p_1` and
|
||||
:math:`p_2` are tangential distortion coefficients.
|
||||
Higher-order coefficients are not considered in OpenCV. In the functions below the coefficients are passed or returned as
|
||||
Higher-order coefficients are not considered in OpenCV.
|
||||
|
||||
The next figure shows two common types of radial distortion: barrel distortion (typically :math:`k_1 > 0` and pincushion distortion (typically :math:`k_1 < 0`).
|
||||
|
||||
.. image:: pics/distortion_examples.png
|
||||
:align: center
|
||||
|
||||
In the functions below the coefficients are passed or returned as
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -476,11 +483,11 @@ Finds the positions of internal corners of the chessboard.
|
||||
|
||||
:param flags: Various operation flags that can be zero or a combination of the following values:
|
||||
|
||||
* **CV_CALIB_CB_ADAPTIVE_THRESH** Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
|
||||
* **CALIB_CB_ADAPTIVE_THRESH** Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
|
||||
|
||||
* **CV_CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with :ocv:func:`equalizeHist` before applying fixed or adaptive thresholding.
|
||||
* **CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with :ocv:func:`equalizeHist` before applying fixed or adaptive thresholding.
|
||||
|
||||
* **CV_CALIB_CB_FILTER_QUADS** Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
|
||||
* **CALIB_CB_FILTER_QUADS** Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
|
||||
|
||||
* **CALIB_CB_FAST_CHECK** Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. This can drastically speed up the call in the degenerate condition when no chessboard is observed.
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -1036,13 +1036,15 @@ icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0)
|
||||
q->neighbors[j] = 0;
|
||||
q->count--;
|
||||
for(int k = 0; k < 4; k++ )
|
||||
{
|
||||
if( q0->neighbors[k] == q )
|
||||
{
|
||||
q0->neighbors[k] = 0;
|
||||
q0->count--;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ CV_IMPL void cvProjectPoints2( const CvMat* objectPoints,
|
||||
{
|
||||
if( dpdc_p )
|
||||
{
|
||||
dpdc_p[0] = 1; dpdc_p[1] = 0;
|
||||
dpdc_p[0] = 1; dpdc_p[1] = 0; // dp_xdc_x; dp_xdc_y
|
||||
dpdc_p[dpdc_step] = 0;
|
||||
dpdc_p[dpdc_step+1] = 1;
|
||||
dpdc_p += dpdc_step*2;
|
||||
@@ -1024,7 +1024,7 @@ CV_IMPL void cvProjectPoints2( const CvMat* objectPoints,
|
||||
{
|
||||
if( fixedAspectRatio )
|
||||
{
|
||||
dpdf_p[0] = 0; dpdf_p[1] = xd*aspectRatio;
|
||||
dpdf_p[0] = 0; dpdf_p[1] = xd*aspectRatio; // dp_xdf_x; dp_xdf_y
|
||||
dpdf_p[dpdf_step] = 0;
|
||||
dpdf_p[dpdf_step+1] = yd;
|
||||
}
|
||||
@@ -1614,6 +1614,8 @@ CV_IMPL double cvCalibrateCamera2( const CvMat* objectPoints,
|
||||
param[4] = k[0]; param[5] = k[1]; param[6] = k[2]; param[7] = k[3];
|
||||
param[8] = k[4]; param[9] = k[5]; param[10] = k[6]; param[11] = k[7];
|
||||
|
||||
if(flags & CALIB_FIX_ASPECT_RATIO)
|
||||
mask[0] = 0;
|
||||
if( flags & CV_CALIB_FIX_FOCAL_LENGTH )
|
||||
mask[0] = mask[1] = 0;
|
||||
if( flags & CV_CALIB_FIX_PRINCIPAL_POINT )
|
||||
|
||||
@@ -369,6 +369,12 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted
|
||||
double scale = 1.0;
|
||||
|
||||
double theta_d = sqrt(pw[0]*pw[0] + pw[1]*pw[1]);
|
||||
|
||||
// the current camera model is only valid up to 180° FOV
|
||||
// for larger FOV the loop below does not converge
|
||||
// clip values so we still get plausible results for super fisheye images > 180°
|
||||
theta_d = min(max(-CV_PI/2., theta_d), CV_PI/2.);
|
||||
|
||||
if (theta_d > 1e-8)
|
||||
{
|
||||
// compensate distortion iteratively
|
||||
@@ -1028,8 +1034,10 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO
|
||||
int a = cv::countNonZero(intrinsicLeft.isEstimate);
|
||||
int b = cv::countNonZero(intrinsicRight.isEstimate);
|
||||
cv::Mat deltas = J2_inv * J.t() * e;
|
||||
intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a);
|
||||
intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b);
|
||||
if (a > 0)
|
||||
intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a);
|
||||
if (b > 0)
|
||||
intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b);
|
||||
omcur = omcur + cv::Vec3d(deltas.rowRange(a + b, a + b + 3));
|
||||
Tcur = Tcur + cv::Vec3d(deltas.rowRange(a + b + 3, a + b + 6));
|
||||
for (int image_idx = 0; image_idx < n_images; ++image_idx)
|
||||
|
||||
@@ -1339,6 +1339,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
|
||||
|
||||
undistortPoints(Mat(pts), upts, M, D, R, P );
|
||||
for( k = 0; k < N*N; k++ )
|
||||
{
|
||||
if( upts[k].x < -imgsize.width*eps || upts[k].x > imgsize.width*(1+eps) ||
|
||||
upts[k].y < -imgsize.height*eps || upts[k].y > imgsize.height*(1+eps) )
|
||||
{
|
||||
@@ -1346,6 +1347,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
|
||||
test_case_idx, pts[k].x, pts[k].y, upts[k].x, upts[k].y);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// step 2. check that all the points inside ROI belong to the original source image
|
||||
Mat temp(imgsize, CV_8U), utemp, map1, map2;
|
||||
|
||||
@@ -329,7 +329,7 @@ TEST_F(fisheyeTest, Homography)
|
||||
EXPECT_MAT_NEAR(std_err, correct_std_err, 1e-12);
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, EtimateUncertainties)
|
||||
TEST_F(fisheyeTest, EstimateUncertainties)
|
||||
{
|
||||
const int n_images = 34;
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(float *inputOutputFrame, const
|
||||
/* const float *localLuminancePTR=localLuminance;
|
||||
float *inputOutputFramePTR=inputOutputFrame;
|
||||
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputOutputFramePTR)
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputOutputFramePTR)
|
||||
{
|
||||
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
|
||||
*(inputOutputFramePTR) = (_maxInputValue+X0)**inputOutputFramePTR/(*inputOutputFramePTR +X0+0.00000000001);
|
||||
@@ -352,7 +352,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
|
||||
const float *localLuminancePTR=localLuminance;
|
||||
const float *inputFramePTR=inputFrame;
|
||||
float *outputFramePTR=outputFrame;
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR, ++outputFramePTR)
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR, ++outputFramePTR)
|
||||
{
|
||||
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
|
||||
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
|
||||
@@ -369,7 +369,7 @@ void BasicRetinaFilter::_localLuminanceAdaptationPosNegValues(const float *input
|
||||
const float *inputFramePTR=inputFrame;
|
||||
float *outputFramePTR=outputFrame;
|
||||
float factor=_maxInputValue*2.0f/(float)CV_PI;
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR)
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR)
|
||||
{
|
||||
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
|
||||
*(outputFramePTR++) = factor*atan(*inputFramePTR/X0);//(_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0);
|
||||
@@ -454,8 +454,8 @@ void BasicRetinaFilter::_horizontalCausalFilter(float *outputFrame, unsigned int
|
||||
//#pragma omp parallel for
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(outputPTR)+ _a* result;
|
||||
@@ -471,9 +471,9 @@ void BasicRetinaFilter::_horizontalCausalFilter_addInput(const float *inputFrame
|
||||
#else
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
register const float* inputPTR=inputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
const float* inputPTR=inputFrame+(IDrowStart+IDrow)*_filterOutput.getNBcolumns();
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(inputPTR++) + _tau**(outputPTR)+ _a* result;
|
||||
@@ -492,8 +492,8 @@ void BasicRetinaFilter::_horizontalAnticausalFilter(float *outputFrame, unsigned
|
||||
#else
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(_filterOutput.getNBcolumns())-1;
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(_filterOutput.getNBcolumns())-1;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(outputPTR)+ _a* result;
|
||||
@@ -510,8 +510,8 @@ void BasicRetinaFilter::_horizontalAnticausalFilter_multGain(float *outputFrame,
|
||||
//#pragma omp parallel for
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(_filterOutput.getNBcolumns())-1;
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(_filterOutput.getNBcolumns())-1;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(outputPTR)+ _a* result;
|
||||
@@ -528,8 +528,8 @@ void BasicRetinaFilter::_verticalCausalFilter(float *outputFrame, unsigned int I
|
||||
#else
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputFrame+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputFrame+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -550,8 +550,8 @@ void BasicRetinaFilter::_verticalAnticausalFilter(float *outputFrame, unsigned i
|
||||
//#pragma omp parallel for
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -573,8 +573,8 @@ void BasicRetinaFilter::_verticalAnticausalFilter_multGain(float *outputFrame, u
|
||||
//#pragma omp parallel for
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -593,11 +593,11 @@ void BasicRetinaFilter::_verticalAnticausalFilter_multGain(float *outputFrame, u
|
||||
// -> squaring horizontal causal filter
|
||||
void BasicRetinaFilter::_squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd)
|
||||
{
|
||||
register float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(inputPTR)**(inputPTR) + _tau**(outputPTR)+ _a* result;
|
||||
@@ -610,12 +610,12 @@ void BasicRetinaFilter::_squaringHorizontalCausalFilter(const float *inputFrame,
|
||||
// vertical anticausal filter that returns the mean value of its result
|
||||
float BasicRetinaFilter::_verticalAnticausalFilter_returnMeanValue(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd)
|
||||
{
|
||||
register float meanValue=0;
|
||||
float meanValue=0;
|
||||
float* offset=outputFrame+_filterOutput.getNBpixels()-_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -652,12 +652,12 @@ void BasicRetinaFilter::_localSquaringSpatioTemporalLPfilter(const float *inputF
|
||||
// this function take an image in input and squares it befor computing
|
||||
void BasicRetinaFilter::_local_squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas)
|
||||
{
|
||||
register float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const unsigned int *integrationAreasPTR=integrationAreas;
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
if (*(integrationAreasPTR++))
|
||||
@@ -674,12 +674,12 @@ void BasicRetinaFilter::_local_squaringHorizontalCausalFilter(const float *input
|
||||
void BasicRetinaFilter::_local_horizontalAnticausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas)
|
||||
{
|
||||
|
||||
register float* outputPTR=outputFrame+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
float* outputPTR=outputFrame+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
const unsigned int *integrationAreasPTR=integrationAreas;
|
||||
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
if (*(integrationAreasPTR++))
|
||||
@@ -698,8 +698,8 @@ void BasicRetinaFilter::_local_verticalCausalFilter(float *outputFrame, unsigned
|
||||
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputFrame+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputFrame+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -721,8 +721,8 @@ void BasicRetinaFilter::_local_verticalAnticausalFilter_multGain(float *outputFr
|
||||
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
@@ -785,11 +785,11 @@ void BasicRetinaFilter::_spatiotemporalLPfilter_Irregular(const float *inputFram
|
||||
// horizontal causal filter wich runs on its input buffer
|
||||
void BasicRetinaFilter::_horizontalCausalFilter_Irregular(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd)
|
||||
{
|
||||
register float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* spatialConstantPTR=&_progressiveSpatialConstant[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* spatialConstantPTR=&_progressiveSpatialConstant[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(outputPTR)+ *(spatialConstantPTR++)* result;
|
||||
@@ -801,12 +801,12 @@ void BasicRetinaFilter::_horizontalCausalFilter_Irregular(float *outputFrame, un
|
||||
// horizontal causal filter with add input
|
||||
void BasicRetinaFilter::_horizontalCausalFilter_Irregular_addInput(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd)
|
||||
{
|
||||
register float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* spatialConstantPTR=&_progressiveSpatialConstant[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* spatialConstantPTR=&_progressiveSpatialConstant[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(inputPTR++) + _tau**(outputPTR)+ *(spatialConstantPTR++)* result;
|
||||
@@ -822,12 +822,12 @@ void BasicRetinaFilter::_horizontalAnticausalFilter_Irregular(float *outputFrame
|
||||
#ifdef MAKE_PARALLEL
|
||||
cv::parallel_for_(cv::Range(IDrowStart,IDrowEnd), Parallel_horizontalAnticausalFilter_Irregular(outputFrame, spatialConstantBuffer, IDrowEnd, _filterOutput.getNBcolumns()));
|
||||
#else
|
||||
register float* outputPTR=outputFrame+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
register const float* spatialConstantPTR=spatialConstantBuffer+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
float* outputPTR=outputFrame+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
const float* spatialConstantPTR=spatialConstantBuffer+IDrowEnd*(_filterOutput.getNBcolumns())-1;
|
||||
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
result = *(outputPTR)+ *(spatialConstantPTR--)* result;
|
||||
@@ -846,9 +846,9 @@ void BasicRetinaFilter::_verticalCausalFilter_Irregular(float *outputFrame, unsi
|
||||
#else
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputFrame+IDcolumn;
|
||||
register const float *spatialConstantPTR=spatialConstantBuffer+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputFrame+IDcolumn;
|
||||
const float *spatialConstantPTR=spatialConstantBuffer+IDcolumn;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
result = *(outputPTR) + *(spatialConstantPTR) * result;
|
||||
@@ -868,10 +868,10 @@ void BasicRetinaFilter::_verticalAnticausalFilter_Irregular_multGain(float *outp
|
||||
const float* gainOffset=&_progressiveGain[0]+_filterOutput.getNBpixels()-_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputOffset+IDcolumn;
|
||||
register const float *spatialConstantPTR=constantOffset+IDcolumn;
|
||||
register const float *progressiveGainPTR=gainOffset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputOffset+IDcolumn;
|
||||
const float *spatialConstantPTR=constantOffset+IDcolumn;
|
||||
const float *progressiveGainPTR=gainOffset+IDcolumn;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
result = *(outputPTR) + *(spatialConstantPTR) * result;
|
||||
|
||||
@@ -476,8 +476,8 @@ namespace cv
|
||||
#endif
|
||||
for (int IDrow=r.start; IDrow!=r.end; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<nbColumns; ++index)
|
||||
{
|
||||
result = *(outputPTR)+ filterParam_a* result;
|
||||
@@ -501,9 +501,9 @@ namespace cv
|
||||
virtual void operator()( const Range& r ) const {
|
||||
for (int IDrow=r.start; IDrow!=r.end; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowStart+IDrow)*nbColumns;
|
||||
register const float* inputPTR=inputFrame+(IDrowStart+IDrow)*nbColumns;
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowStart+IDrow)*nbColumns;
|
||||
const float* inputPTR=inputFrame+(IDrowStart+IDrow)*nbColumns;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<nbColumns; ++index)
|
||||
{
|
||||
result = *(inputPTR++) + filterParam_tau**(outputPTR)+ filterParam_a* result;
|
||||
@@ -526,8 +526,8 @@ namespace cv
|
||||
virtual void operator()( const Range& r ) const {
|
||||
for (int IDcolumn=r.start; IDcolumn!=r.end; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputFrame+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputFrame+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<nbRows; ++index)
|
||||
{
|
||||
@@ -554,8 +554,8 @@ namespace cv
|
||||
float* offset=outputFrame+nbColumns*nbRows-nbColumns;
|
||||
for (int IDcolumn=r.start; IDcolumn!=r.end; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
|
||||
for (unsigned int index=0; index<nbRows; ++index)
|
||||
{
|
||||
@@ -582,7 +582,7 @@ namespace cv
|
||||
const float *localLuminancePTR=localLuminance+r.start;
|
||||
const float *inputFramePTR=inputFrame+r.start;
|
||||
float *outputFramePTR=outputFrame+r.start;
|
||||
for (register int IDpixel=r.start ; IDpixel!=r.end ; ++IDpixel, ++inputFramePTR, ++outputFramePTR)
|
||||
for (int IDpixel=r.start ; IDpixel!=r.end ; ++IDpixel, ++inputFramePTR, ++outputFramePTR)
|
||||
{
|
||||
float X0=*(localLuminancePTR++)*localLuminanceFactor+localLuminanceAddon;
|
||||
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
|
||||
@@ -608,9 +608,9 @@ namespace cv
|
||||
|
||||
for (int IDrow=r.start; IDrow!=r.end; ++IDrow)
|
||||
{
|
||||
register float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
register const float* spatialConstantPTR=spatialConstantBuffer+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
register float result=0;
|
||||
float* outputPTR=outputFrame+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
const float* spatialConstantPTR=spatialConstantBuffer+(IDrowEnd-IDrow)*(nbColumns)-1;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<nbColumns; ++index)
|
||||
{
|
||||
result = *(outputPTR)+ *(spatialConstantPTR--)* result;
|
||||
@@ -633,9 +633,9 @@ namespace cv
|
||||
virtual void operator()( const Range& r ) const {
|
||||
for (int IDcolumn=r.start; IDcolumn!=r.end; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputFrame+IDcolumn;
|
||||
register const float* spatialConstantPTR=spatialConstantBuffer+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputFrame+IDcolumn;
|
||||
const float* spatialConstantPTR=spatialConstantBuffer+IDcolumn;
|
||||
for (unsigned int index=0; index<nbRows; ++index)
|
||||
{
|
||||
result = *(outputPTR) + *(spatialConstantPTR) * result;
|
||||
|
||||
@@ -409,7 +409,7 @@ std::valarray<float> &ImageLogPolProjection::runProjection(const std::valarray<f
|
||||
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_tempBuffer[0]+_filterOutput.getNBpixels()*2);
|
||||
|
||||
// applying image projection/resampling
|
||||
register unsigned int *transformTablePTR=&_transformTable[0];
|
||||
unsigned int *transformTablePTR=&_transformTable[0];
|
||||
for (unsigned int i=0 ; i<_usefullpixelIndex ; i+=2, transformTablePTR+=2)
|
||||
{
|
||||
#ifdef IMAGELOGPOLPROJECTION_DEBUG
|
||||
@@ -429,7 +429,7 @@ std::valarray<float> &ImageLogPolProjection::runProjection(const std::valarray<f
|
||||
_spatiotemporalLPfilter_Irregular(get_data(inputFrame), &_irregularLPfilteredFrame[0]);
|
||||
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_irregularLPfilteredFrame[0]);
|
||||
// applying image projection/resampling
|
||||
register unsigned int *transformTablePTR=&_transformTable[0];
|
||||
unsigned int *transformTablePTR=&_transformTable[0];
|
||||
for (unsigned int i=0 ; i<_usefullpixelIndex ; i+=2, transformTablePTR+=2)
|
||||
{
|
||||
#ifdef IMAGELOGPOLPROJECTION_DEBUG
|
||||
|
||||
@@ -156,12 +156,12 @@ void MagnoRetinaFilter::_amacrineCellsComputing(const float *OPL_ON, const float
|
||||
#ifdef MAKE_PARALLEL
|
||||
cv::parallel_for_(cv::Range(0,_filterOutput.getNBpixels()), Parallel_amacrineCellsComputing(OPL_ON, OPL_OFF, &_previousInput_ON[0], &_previousInput_OFF[0], &_amacrinCellsTempOutput_ON[0], &_amacrinCellsTempOutput_OFF[0], _temporalCoefficient));
|
||||
#else
|
||||
register const float *OPL_ON_PTR=OPL_ON;
|
||||
register const float *OPL_OFF_PTR=OPL_OFF;
|
||||
register float *previousInput_ON_PTR= &_previousInput_ON[0];
|
||||
register float *previousInput_OFF_PTR= &_previousInput_OFF[0];
|
||||
register float *amacrinCellsTempOutput_ON_PTR= &_amacrinCellsTempOutput_ON[0];
|
||||
register float *amacrinCellsTempOutput_OFF_PTR= &_amacrinCellsTempOutput_OFF[0];
|
||||
const float *OPL_ON_PTR=OPL_ON;
|
||||
const float *OPL_OFF_PTR=OPL_OFF;
|
||||
float *previousInput_ON_PTR= &_previousInput_ON[0];
|
||||
float *previousInput_OFF_PTR= &_previousInput_OFF[0];
|
||||
float *amacrinCellsTempOutput_ON_PTR= &_amacrinCellsTempOutput_ON[0];
|
||||
float *amacrinCellsTempOutput_OFF_PTR= &_amacrinCellsTempOutput_OFF[0];
|
||||
|
||||
for (unsigned int IDpixel=0 ; IDpixel<this->getNBpixels(); ++IDpixel)
|
||||
{
|
||||
@@ -198,10 +198,10 @@ const std::valarray<float> &MagnoRetinaFilter::runFilter(const std::valarray<flo
|
||||
_localLuminanceAdaptation(&_magnoXOutputOFF[0], &_localProcessBufferOFF[0]);
|
||||
|
||||
/* Compute MagnoY */
|
||||
register float *magnoYOutput= &(*_magnoYOutput)[0];
|
||||
register float *magnoXOutputON_PTR= &_magnoXOutputON[0];
|
||||
register float *magnoXOutputOFF_PTR= &_magnoXOutputOFF[0];
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
float *magnoYOutput= &(*_magnoYOutput)[0];
|
||||
float *magnoXOutputON_PTR= &_magnoXOutputON[0];
|
||||
float *magnoXOutputOFF_PTR= &_magnoXOutputOFF[0];
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
*(magnoYOutput++)=*(magnoXOutputON_PTR++)+*(magnoXOutputOFF_PTR++);
|
||||
|
||||
return (*_magnoYOutput);
|
||||
|
||||
@@ -210,12 +210,12 @@ namespace cv
|
||||
:OPL_ON(OPL_ON_PTR), OPL_OFF(OPL_OFF_PTR), previousInput_ON(previousInput_ON_PTR), previousInput_OFF(previousInput_OFF_PTR), amacrinCellsTempOutput_ON(amacrinCellsTempOutput_ON_PTR), amacrinCellsTempOutput_OFF(amacrinCellsTempOutput_OFF_PTR), temporalCoefficient(temporalCoefficientVal) {}
|
||||
|
||||
virtual void operator()( const Range& r ) const {
|
||||
register const float *OPL_ON_PTR=OPL_ON+r.start;
|
||||
register const float *OPL_OFF_PTR=OPL_OFF+r.start;
|
||||
register float *previousInput_ON_PTR= previousInput_ON+r.start;
|
||||
register float *previousInput_OFF_PTR= previousInput_OFF+r.start;
|
||||
register float *amacrinCellsTempOutput_ON_PTR= amacrinCellsTempOutput_ON+r.start;
|
||||
register float *amacrinCellsTempOutput_OFF_PTR= amacrinCellsTempOutput_OFF+r.start;
|
||||
const float *OPL_ON_PTR=OPL_ON+r.start;
|
||||
const float *OPL_OFF_PTR=OPL_OFF+r.start;
|
||||
float *previousInput_ON_PTR= previousInput_ON+r.start;
|
||||
float *previousInput_OFF_PTR= previousInput_OFF+r.start;
|
||||
float *amacrinCellsTempOutput_ON_PTR= amacrinCellsTempOutput_ON+r.start;
|
||||
float *amacrinCellsTempOutput_OFF_PTR= amacrinCellsTempOutput_OFF+r.start;
|
||||
|
||||
for (int IDpixel=r.start ; IDpixel!=r.end; ++IDpixel)
|
||||
{
|
||||
|
||||
@@ -189,11 +189,11 @@ const std::valarray<float> &ParvoRetinaFilter::runFilter(const std::valarray<flo
|
||||
//
|
||||
//// loop that makes the difference between photoreceptor cells output and horizontal cells
|
||||
//// positive part goes on the ON way, negative pat goes on the OFF way
|
||||
register float *parvocellularOutputONminusOFF_PTR=&(*_parvocellularOutputONminusOFF)[0];
|
||||
register float *parvocellularOutputON_PTR=&_parvocellularOutputON[0];
|
||||
register float *parvocellularOutputOFF_PTR=&_parvocellularOutputOFF[0];
|
||||
float *parvocellularOutputONminusOFF_PTR=&(*_parvocellularOutputONminusOFF)[0];
|
||||
float *parvocellularOutputON_PTR=&_parvocellularOutputON[0];
|
||||
float *parvocellularOutputOFF_PTR=&_parvocellularOutputOFF[0];
|
||||
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
*(parvocellularOutputONminusOFF_PTR++)= (*(parvocellularOutputON_PTR++)-*(parvocellularOutputOFF_PTR++));
|
||||
}
|
||||
return (*_parvocellularOutputONminusOFF);
|
||||
@@ -215,7 +215,7 @@ void ParvoRetinaFilter::_OPL_OnOffWaysComputing() // WARNING : this method requi
|
||||
float *parvocellularOutputOFF_PTR= &_parvocellularOutputOFF[0];
|
||||
// compute bipolar cells response equal to photoreceptors minus horizontal cells response
|
||||
// and copy the result on parvo cellular outputs... keeping time before their local contrast adaptation for final result
|
||||
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
for (unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel)
|
||||
{
|
||||
float pixelDifference = *(photoreceptorsOutput_PTR++) -*(horizontalCellsOutput_PTR++);
|
||||
// test condition to allow write pixelDifference in ON or OFF buffer and 0 in the over
|
||||
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
float *parvocellularOutputON_PTR= parvocellularOutputON+r.start;
|
||||
float *parvocellularOutputOFF_PTR= parvocellularOutputOFF+r.start;
|
||||
|
||||
for (register int IDpixel=r.start ; IDpixel!=r.end ; ++IDpixel)
|
||||
for (int IDpixel=r.start ; IDpixel!=r.end ; ++IDpixel)
|
||||
{
|
||||
float pixelDifference = *(photoreceptorsOutput_PTR++) -*(horizontalCellsOutput_PTR++);
|
||||
// test condition to allow write pixelDifference in ON or OFF buffer and 0 in the over
|
||||
|
||||
@@ -238,7 +238,7 @@ void RetinaColor::_initColorSampling()
|
||||
_spatiotemporalLPfilter(&_RGBmosaic[0]+_filterOutput.getNBpixels(), &_colorLocalDensity[0]+_filterOutput.getNBpixels());
|
||||
_spatiotemporalLPfilter(&_RGBmosaic[0]+_filterOutput.getDoubleNBpixels(), &_colorLocalDensity[0]+_filterOutput.getDoubleNBpixels());
|
||||
unsigned int maxNBpixels=3*_filterOutput.getNBpixels();
|
||||
register float *colorLocalDensityPTR=&_colorLocalDensity[0];
|
||||
float *colorLocalDensityPTR=&_colorLocalDensity[0];
|
||||
for (unsigned int i=0;i<maxNBpixels;++i, ++colorLocalDensityPTR)
|
||||
*colorLocalDensityPTR=1.f/ *colorLocalDensityPTR;
|
||||
|
||||
@@ -257,8 +257,8 @@ void RetinaColor::runColorDemultiplexing(const std::valarray<float> &multiplexed
|
||||
// -> first set demultiplexed frame to 0
|
||||
_demultiplexedTempBuffer=0;
|
||||
// -> demultiplex process
|
||||
register unsigned int *colorSamplingPRT=&_colorSampling[0];
|
||||
register const float *multiplexedColorFramePtr=get_data(multiplexedColorFrame);
|
||||
unsigned int *colorSamplingPRT=&_colorSampling[0];
|
||||
const float *multiplexedColorFramePtr=get_data(multiplexedColorFrame);
|
||||
for (unsigned int indexa=0; indexa<_filterOutput.getNBpixels() ; ++indexa)
|
||||
_demultiplexedTempBuffer[*(colorSamplingPRT++)]=*(multiplexedColorFramePtr++);
|
||||
|
||||
@@ -279,9 +279,9 @@ void RetinaColor::runColorDemultiplexing(const std::valarray<float> &multiplexed
|
||||
}*/
|
||||
|
||||
// normalize by the photoreceptors local density and retrieve the local luminance
|
||||
register float *chrominancePTR= &_chrominance[0];
|
||||
register float *colorLocalDensityPTR= &_colorLocalDensity[0];
|
||||
register float *luminance= &(*_luminance)[0];
|
||||
float *chrominancePTR= &_chrominance[0];
|
||||
float *colorLocalDensityPTR= &_colorLocalDensity[0];
|
||||
float *luminance= &(*_luminance)[0];
|
||||
if (!adaptiveFiltering)// compute the gradient on the luminance
|
||||
{
|
||||
if (_samplingMethod==RETINA_COLOR_RANDOM)
|
||||
@@ -325,7 +325,7 @@ void RetinaColor::runColorDemultiplexing(const std::valarray<float> &multiplexed
|
||||
|
||||
}else
|
||||
{
|
||||
register const float *multiplexedColorFramePTR= get_data(multiplexedColorFrame);
|
||||
const float *multiplexedColorFramePTR= get_data(multiplexedColorFrame);
|
||||
for (unsigned int indexc=0; indexc<_filterOutput.getNBpixels() ; ++indexc, ++chrominancePTR, ++colorLocalDensityPTR, ++luminance, ++multiplexedColorFramePTR)
|
||||
{
|
||||
// normalize by photoreceptors density
|
||||
@@ -408,8 +408,8 @@ void RetinaColor::runColorDemultiplexing(const std::valarray<float> &multiplexed
|
||||
void RetinaColor::runColorMultiplexing(const std::valarray<float> &demultiplexedInputFrame, std::valarray<float> &multiplexedFrame)
|
||||
{
|
||||
// multiply each color layer by its bayer mask
|
||||
register unsigned int *colorSamplingPTR= &_colorSampling[0];
|
||||
register float *multiplexedFramePTR= &multiplexedFrame[0];
|
||||
unsigned int *colorSamplingPTR= &_colorSampling[0];
|
||||
float *multiplexedFramePTR= &multiplexedFrame[0];
|
||||
for (unsigned int indexp=0; indexp<_filterOutput.getNBpixels(); ++indexp)
|
||||
*(multiplexedFramePTR++)=demultiplexedInputFrame[*(colorSamplingPTR++)];
|
||||
}
|
||||
@@ -436,8 +436,8 @@ void RetinaColor::clipRGBOutput_0_maxInputValue(float *inputOutputBuffer, const
|
||||
#ifdef MAKE_PARALLEL // call the TemplateBuffer TBB clipping method
|
||||
cv::parallel_for_(cv::Range(0,_filterOutput.getNBpixels()*3), Parallel_clipBufferValues<float>(inputOutputBuffer, 0, maxInputValue));
|
||||
#else
|
||||
register float *inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (register unsigned int jf = 0; jf < _filterOutput.getNBpixels()*3; ++jf, ++inputOutputBufferPTR)
|
||||
float *inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (unsigned int jf = 0; jf < _filterOutput.getNBpixels()*3; ++jf, ++inputOutputBufferPTR)
|
||||
{
|
||||
if (*inputOutputBufferPTR>maxInputValue)
|
||||
*inputOutputBufferPTR=maxInputValue;
|
||||
@@ -583,12 +583,12 @@ void RetinaColor::_adaptiveHorizontalCausalFilter_addInput(const float *inputFra
|
||||
#ifdef MAKE_PARALLEL
|
||||
cv::parallel_for_(cv::Range(IDrowStart,IDrowEnd), Parallel_adaptiveHorizontalCausalFilter_addInput(inputFrame, outputFrame, &_imageGradient[0], _filterOutput.getNBcolumns()));
|
||||
#else
|
||||
register float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
register const float *imageGradientPTR= &_imageGradient[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
float* outputPTR=outputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float* inputPTR=inputFrame+IDrowStart*_filterOutput.getNBcolumns();
|
||||
const float *imageGradientPTR= &_imageGradient[0]+IDrowStart*_filterOutput.getNBcolumns();
|
||||
for (unsigned int IDrow=IDrowStart; IDrow<IDrowEnd; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBcolumns(); ++index)
|
||||
{
|
||||
//std::cout<<(*imageGradientPTR)<<" ";
|
||||
@@ -612,9 +612,9 @@ void RetinaColor::_adaptiveVerticalAnticausalFilter_multGain(float *outputFrame,
|
||||
|
||||
for (unsigned int IDcolumn=IDcolumnStart; IDcolumn<IDcolumnEnd; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=outputOffset+IDcolumn;
|
||||
register float *imageGradientPTR=gradOffset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=outputOffset+IDcolumn;
|
||||
float *imageGradientPTR=gradOffset+IDcolumn;
|
||||
for (unsigned int index=0; index<_filterOutput.getNBrows(); ++index)
|
||||
{
|
||||
result = *(outputPTR) + (*(imageGradientPTR)) * result;
|
||||
|
||||
@@ -289,12 +289,12 @@ namespace cv
|
||||
:outputFrame(bufferToProcess), inputFrame(inputImg), imageGradient(imageGrad), nbColumns(nbCols) {};
|
||||
|
||||
virtual void operator()( const Range& r ) const {
|
||||
register float* outputPTR=outputFrame+r.start*nbColumns;
|
||||
register const float* inputPTR=inputFrame+r.start*nbColumns;
|
||||
register const float *imageGradientPTR= imageGradient+r.start*nbColumns;
|
||||
float* outputPTR=outputFrame+r.start*nbColumns;
|
||||
const float* inputPTR=inputFrame+r.start*nbColumns;
|
||||
const float *imageGradientPTR= imageGradient+r.start*nbColumns;
|
||||
for (int IDrow=r.start; IDrow!=r.end; ++IDrow)
|
||||
{
|
||||
register float result=0;
|
||||
float result=0;
|
||||
for (unsigned int index=0; index<nbColumns; ++index)
|
||||
{
|
||||
result = *(inputPTR++) + (*imageGradientPTR++)* result;
|
||||
@@ -320,9 +320,9 @@ namespace cv
|
||||
const float* gradOffset= imageGradient+nbColumns*nbRows-nbColumns;
|
||||
for (int IDcolumn=r.start; IDcolumn!=r.end; ++IDcolumn)
|
||||
{
|
||||
register float result=0;
|
||||
register float *outputPTR=offset+IDcolumn;
|
||||
register const float *imageGradientPTR=gradOffset+IDcolumn;
|
||||
float result=0;
|
||||
float *outputPTR=offset+IDcolumn;
|
||||
const float *imageGradientPTR=gradOffset+IDcolumn;
|
||||
for (unsigned int index=0; index<nbRows; ++index)
|
||||
{
|
||||
result = *(outputPTR) + *(imageGradientPTR) * result;
|
||||
|
||||
@@ -473,10 +473,10 @@ namespace cv
|
||||
// return image with center Parvo and peripheral Magno channels
|
||||
void RetinaFilter::_processRetinaParvoMagnoMapping()
|
||||
{
|
||||
register float *hybridParvoMagnoPTR= &_retinaParvoMagnoMappedFrame[0];
|
||||
register const float *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
|
||||
register const float *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
|
||||
register float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
|
||||
float *hybridParvoMagnoPTR= &_retinaParvoMagnoMappedFrame[0];
|
||||
const float *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
|
||||
const float *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
|
||||
float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
|
||||
|
||||
for (unsigned int i=0 ; i<_photoreceptorsPrefilter.getNBpixels() ; ++i, hybridParvoMagnoCoefTablePTR+=2)
|
||||
{
|
||||
@@ -495,9 +495,9 @@ namespace cv
|
||||
if (parvoFovealResponse.size() != _ParvoRetinaFilter.getNBpixels())
|
||||
return false;
|
||||
|
||||
register const float *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
|
||||
register float *fovealParvoResponsePTR= &parvoFovealResponse[0];
|
||||
register float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
|
||||
const float *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
|
||||
float *fovealParvoResponsePTR= &parvoFovealResponse[0];
|
||||
float *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
|
||||
|
||||
for (unsigned int i=0 ; i<_photoreceptorsPrefilter.getNBpixels() ; ++i, hybridParvoMagnoCoefTablePTR+=2)
|
||||
{
|
||||
@@ -515,9 +515,9 @@ namespace cv
|
||||
if (magnoParafovealResponse.size() != _MagnoRetinaFilter.getNBpixels())
|
||||
return false;
|
||||
|
||||
register const float *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
|
||||
register float *parafovealMagnoResponsePTR=&magnoParafovealResponse[0];
|
||||
register float *hybridParvoMagnoCoefTablePTR=&_retinaParvoMagnoMapCoefTable[0]+1;
|
||||
const float *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
|
||||
float *parafovealMagnoResponsePTR=&magnoParafovealResponse[0];
|
||||
float *hybridParvoMagnoCoefTablePTR=&_retinaParvoMagnoMapCoefTable[0]+1;
|
||||
|
||||
for (unsigned int i=0 ; i<_photoreceptorsPrefilter.getNBpixels() ; ++i, hybridParvoMagnoCoefTablePTR+=2)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ static Mat diffX(Mat &src)
|
||||
|
||||
static Mat getGradient(Mat &src)
|
||||
{
|
||||
register int x, y;
|
||||
int x, y;
|
||||
Mat dst(src.size(), src.type());
|
||||
dst.setTo(0);
|
||||
for (y = 0; y < src.rows - 1; y++) {
|
||||
@@ -109,10 +109,10 @@ static Mat getGradient(Mat &src)
|
||||
static Mat getG_c(Mat &src, float l)
|
||||
{
|
||||
Mat dst(src.size(), src.type());
|
||||
for (register int y = 0; y < src.rows; y++) {
|
||||
for (int y = 0; y < src.rows; y++) {
|
||||
float *pSrc = src.ptr<float>(y);
|
||||
float *pDst = dst.ptr<float>(y);
|
||||
for (register int x = 0; x < src.cols; x++)
|
||||
for (int x = 0; x < src.cols; x++)
|
||||
pDst[x] = 0.5f*l / sqrtf(l*l + pSrc[x]*pSrc[x]);
|
||||
}
|
||||
return dst;
|
||||
@@ -121,10 +121,10 @@ static Mat getG_c(Mat &src, float l)
|
||||
static Mat getG_p(Mat &src, float l)
|
||||
{
|
||||
Mat dst(src.size(), src.type());
|
||||
for (register int y = 0; y < src.rows; y++) {
|
||||
for (int y = 0; y < src.rows; y++) {
|
||||
float *pSrc = src.ptr<float>(y);
|
||||
float *pDst = dst.ptr<float>(y);
|
||||
for (register int x = 0; x < src.cols; x++)
|
||||
for (int x = 0; x < src.cols; x++)
|
||||
pDst[x] = 0.5f*l*l / (l*l + pSrc[x]*pSrc[x]);
|
||||
}
|
||||
return dst;
|
||||
@@ -132,7 +132,7 @@ static Mat getG_p(Mat &src, float l)
|
||||
|
||||
void StereoVar::VariationalSolver(Mat &I1, Mat &I2, Mat &I2x, Mat &u, int level)
|
||||
{
|
||||
register int n, x, y;
|
||||
int n, x, y;
|
||||
float gl = 1, gr = 1, gu = 1, gd = 1, gc = 4;
|
||||
Mat g_c, g_p;
|
||||
Mat U;
|
||||
|
||||
@@ -89,8 +89,8 @@ public:
|
||||
: bufferToClip(bufferToProcess), minValue(min), maxValue(max){}
|
||||
|
||||
virtual void operator()( const cv::Range &r ) const {
|
||||
register type *inputOutputBufferPTR=bufferToClip+r.start;
|
||||
for (register int jf = r.start; jf != r.end; ++jf, ++inputOutputBufferPTR)
|
||||
type *inputOutputBufferPTR=bufferToClip+r.start;
|
||||
for (int jf = r.start; jf != r.end; ++jf, ++inputOutputBufferPTR)
|
||||
{
|
||||
if (*inputOutputBufferPTR>maxValue)
|
||||
*inputOutputBufferPTR=maxValue;
|
||||
@@ -428,8 +428,8 @@ namespace cv
|
||||
type maxValue=inputOutputBuffer[0], minValue=inputOutputBuffer[0];
|
||||
|
||||
// get the min and max value
|
||||
register type *inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (register size_t j = 0; j<processedPixels; ++j)
|
||||
type *inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (size_t j = 0; j<processedPixels; ++j)
|
||||
{
|
||||
type pixValue = *(inputOutputBufferPTR++);
|
||||
if (maxValue < pixValue)
|
||||
@@ -443,7 +443,7 @@ namespace cv
|
||||
type offset = (type)(-minValue*factor);
|
||||
|
||||
inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (register size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR)
|
||||
for (size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR)
|
||||
*inputOutputBufferPTR=*(inputOutputBufferPTR)*factor+offset;
|
||||
|
||||
}
|
||||
@@ -458,10 +458,10 @@ namespace cv
|
||||
|
||||
type X0cube=sensitivity*sensitivity*sensitivity;
|
||||
|
||||
register type *inputBufferPTR=inputBuffer;
|
||||
register type *outputBufferPTR=outputBuffer;
|
||||
type *inputBufferPTR=inputBuffer;
|
||||
type *outputBufferPTR=outputBuffer;
|
||||
|
||||
for (register size_t j = 0; j < _NBpixels; ++j, ++inputBufferPTR)
|
||||
for (size_t j = 0; j < _NBpixels; ++j, ++inputBufferPTR)
|
||||
{
|
||||
|
||||
type currentCubeLuminance=*inputBufferPTR**inputBufferPTR**inputBufferPTR;
|
||||
@@ -483,10 +483,10 @@ namespace cv
|
||||
|
||||
type X0=maxOutputValue/(sensitivity-(type)1.0);
|
||||
|
||||
register type *inputBufferPTR=inputBuffer;
|
||||
register type *outputBufferPTR=outputBuffer;
|
||||
type *inputBufferPTR=inputBuffer;
|
||||
type *outputBufferPTR=outputBuffer;
|
||||
|
||||
for (register size_t j = 0; j < nbPixels; ++j, ++inputBufferPTR)
|
||||
for (size_t j = 0; j < nbPixels; ++j, ++inputBufferPTR)
|
||||
*(outputBufferPTR++)=(meanValue+(meanValue+X0)*(*(inputBufferPTR)-meanValue)/(_abs(*(inputBufferPTR)-meanValue)+X0));
|
||||
|
||||
}
|
||||
@@ -501,12 +501,12 @@ namespace cv
|
||||
type meanValue=0, stdValue=0;
|
||||
|
||||
// compute mean value
|
||||
for (register size_t j = 0; j < _NBpixels; ++j)
|
||||
for (size_t j = 0; j < _NBpixels; ++j)
|
||||
meanValue+=inputOutputBuffer[j];
|
||||
meanValue/=((type)_NBpixels);
|
||||
|
||||
// compute std value
|
||||
register type *inputOutputBufferPTR=inputOutputBuffer;
|
||||
type *inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (size_t index=0;index<_NBpixels;++index)
|
||||
{
|
||||
type inputMinusMean=*(inputOutputBufferPTR++)-meanValue;
|
||||
|
||||
@@ -31,7 +31,7 @@ Aligns a buffer size to the specified number of bytes.
|
||||
|
||||
:param n: Alignment size that must be a power of two.
|
||||
|
||||
The function returns the minimum number that is greater or equal to ``sz`` and is divisible by ``n`` :
|
||||
The function returns the minimum number that is greater than or equal to ``sz`` and is divisible by ``n`` :
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -363,7 +363,7 @@ Always returns 0 if called outside of parallel region.
|
||||
|
||||
.. ocv:function:: int getThreadNum()
|
||||
|
||||
The exact meaning of return value depends on the threading framework used by OpenCV library:
|
||||
The exact meaning of the return value depends on the threading framework used by OpenCV library:
|
||||
|
||||
* **TBB** – Unsupported with current 4.1 TBB release. May be will be supported in future.
|
||||
* **OpenMP** – The thread number, within the current team, of the calling thread.
|
||||
@@ -450,7 +450,7 @@ This operation is used in the simplest or most complex image processing function
|
||||
setNumThreads
|
||||
-----------------
|
||||
OpenCV will try to set the number of threads for the next parallel region.
|
||||
If ``threads == 0``, OpenCV will disable threading optimizations and run all it's
|
||||
If ``threads == 0``, OpenCV will disable threading optimizations and run all its
|
||||
functions sequentially. Passing ``threads < 0`` will reset threads number to system default.
|
||||
This function must be called outside of parallel region.
|
||||
|
||||
@@ -458,14 +458,14 @@ This function must be called outside of parallel region.
|
||||
|
||||
:param nthreads: Number of threads used by OpenCV.
|
||||
|
||||
OpenCV will try to run it's functions with specified threads number, but
|
||||
OpenCV will try to run its functions with specified threads number, but
|
||||
some behaviour differs from framework:
|
||||
|
||||
* **TBB** – User-defined parallel constructions will run with the same threads number,
|
||||
if another does not specified. If late on user creates own scheduler, OpenCV will be use it.
|
||||
if another is not specified. If late on user creates his own scheduler, OpenCV will be use it.
|
||||
* **OpenMP** – No special defined behaviour.
|
||||
* **Concurrency** – If ``threads == 1``, OpenCV will disable threading optimizations
|
||||
and run it's functions sequentially.
|
||||
and run its functions sequentially.
|
||||
* **GCD** – Supports only values <= 0.
|
||||
* **C=** – No special defined behaviour.
|
||||
|
||||
|
||||
@@ -203,11 +203,13 @@ cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
|
||||
{
|
||||
rotation(data(Rect(0, 0, 3, 3)));
|
||||
translation(data(Rect(3, 0, 1, 3)));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation(data);
|
||||
translation(t);
|
||||
}
|
||||
|
||||
rotation(data);
|
||||
translation(t);
|
||||
matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
|
||||
matrix.val[15] = 1;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
The class is specialized for each fundamental numerical data type supported by OpenCV.
|
||||
It provides DataDepth<T>::value constant.
|
||||
*/
|
||||
template<typename _Tp> class DataDepth {};
|
||||
template<typename _Tp> class DataDepth { public: enum { value = -1, fmt = 0 }; };
|
||||
|
||||
template<> class DataDepth<bool> { public: enum { value = CV_8U, fmt=(int)'u' }; };
|
||||
template<> class DataDepth<uchar> { public: enum { value = CV_8U, fmt=(int)'u' }; };
|
||||
@@ -880,8 +880,10 @@ public:
|
||||
|
||||
|
||||
typedef Point_<int> Point2i;
|
||||
typedef Point_<int64> Point2l;
|
||||
typedef Point2i Point;
|
||||
typedef Size_<int> Size2i;
|
||||
typedef Size_<int64> Size2l;
|
||||
typedef Size_<double> Size2d;
|
||||
typedef Size2i Size;
|
||||
typedef Rect_<int> Rect;
|
||||
@@ -910,8 +912,10 @@ public:
|
||||
|
||||
//! returns 4 vertices of the rectangle
|
||||
void points(Point2f pts[]) const;
|
||||
//! returns the minimal up-right rectangle containing the rotated rectangle
|
||||
//! returns the minimal up-right integer rectangle containing the rotated rectangle
|
||||
Rect boundingRect() const;
|
||||
//! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images
|
||||
Rect_<float> boundingRect2f() const;
|
||||
//! conversion to the old-style CvBox2D structure
|
||||
operator CvBox2D() const;
|
||||
|
||||
@@ -2709,6 +2713,7 @@ CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts,
|
||||
|
||||
//! clips the line segment by the rectangle Rect(0, 0, imgSize.width, imgSize.height)
|
||||
CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2);
|
||||
CV_EXPORTS bool clipLine(Size2l imgSize, CV_IN_OUT Point2l& pt1, CV_IN_OUT Point2l& pt2);
|
||||
|
||||
//! clips the line segment by the rectangle imgRect
|
||||
CV_EXPORTS_W bool clipLine(Rect imgRect, CV_OUT CV_IN_OUT Point& pt1, CV_OUT CV_IN_OUT Point& pt2);
|
||||
@@ -2746,6 +2751,9 @@ public:
|
||||
CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle,
|
||||
int arcStart, int arcEnd, int delta,
|
||||
CV_OUT vector<Point>& pts );
|
||||
CV_EXPORTS void ellipse2Poly( Point2d center, Size2d axes, int angle,
|
||||
int arcStart, int arcEnd, int delta,
|
||||
CV_OUT vector<Point2d>& pts );
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -3240,6 +3248,9 @@ public:
|
||||
//! returns read-only pointer to the real buffer, stack-allocated or head-allocated
|
||||
operator const _Tp* () const;
|
||||
|
||||
//! returns number of allocated elements
|
||||
size_t getSize() const;
|
||||
|
||||
protected:
|
||||
//! pointer to the real buffer, can point to buf if the buffer is small enough
|
||||
_Tp* ptr;
|
||||
|
||||
@@ -122,27 +122,23 @@ namespace cv
|
||||
typedef PtrStep<float> PtrStepf;
|
||||
typedef PtrStep<int> PtrStepi;
|
||||
|
||||
|
||||
#if defined __GNUC__
|
||||
#define __CV_GPU_DEPR_BEFORE__
|
||||
#define __CV_GPU_DEPR_AFTER__ __attribute__ ((deprecated))
|
||||
#define CV_GPU_DEPRECATED __attribute__ ((deprecated))
|
||||
#elif defined(__MSVC__) //|| defined(__CUDACC__)
|
||||
#pragma deprecated(DevMem2D_)
|
||||
#define __CV_GPU_DEPR_BEFORE__ __declspec(deprecated)
|
||||
#define __CV_GPU_DEPR_AFTER__
|
||||
#define CV_GPU_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define __CV_GPU_DEPR_BEFORE__
|
||||
#define __CV_GPU_DEPR_AFTER__
|
||||
#define CV_GPU_DEPRECATED
|
||||
#endif
|
||||
|
||||
template <typename T> struct __CV_GPU_DEPR_BEFORE__ DevMem2D_ : public PtrStepSz<T>
|
||||
template <typename T> struct DevMem2D_ : public PtrStepSz<T>
|
||||
{
|
||||
DevMem2D_() {}
|
||||
DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
|
||||
CV_GPU_DEPRECATED DevMem2D_() {}
|
||||
CV_GPU_DEPRECATED DevMem2D_(int rows_, int cols_, T* data_, size_t step_) : PtrStepSz<T>(rows_, cols_, data_, step_) {}
|
||||
|
||||
template <typename U>
|
||||
explicit __CV_GPU_DEPR_BEFORE__ DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
|
||||
} __CV_GPU_DEPR_AFTER__ ;
|
||||
explicit CV_GPU_DEPRECATED DevMem2D_(const DevMem2D_<U>& d) : PtrStepSz<T>(d.rows, d.cols, (T*)d.data, d.step) {}
|
||||
};
|
||||
|
||||
typedef DevMem2D_<unsigned char> DevMem2Db;
|
||||
typedef DevMem2Db DevMem2D;
|
||||
@@ -174,8 +170,7 @@ namespace cv
|
||||
typedef PtrElemStep_<float> PtrElemStepf;
|
||||
typedef PtrElemStep_<int> PtrElemStepi;
|
||||
|
||||
//#undef __CV_GPU_DEPR_BEFORE__
|
||||
//#undef __CV_GPU_DEPR_AFTER__
|
||||
//#undef CV_GPU_DEPRECATED
|
||||
|
||||
namespace device
|
||||
{
|
||||
|
||||
@@ -277,10 +277,9 @@ namespace cv { namespace gpu
|
||||
template <typename _Tp> operator PtrStep<_Tp>() const;
|
||||
|
||||
// Deprecated function
|
||||
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator DevMem2D_<_Tp>() const __CV_GPU_DEPR_AFTER__;
|
||||
__CV_GPU_DEPR_BEFORE__ template <typename _Tp> operator PtrStep_<_Tp>() const __CV_GPU_DEPR_AFTER__;
|
||||
#undef __CV_GPU_DEPR_BEFORE__
|
||||
#undef __CV_GPU_DEPR_AFTER__
|
||||
template <typename _Tp> CV_GPU_DEPRECATED operator DevMem2D_<_Tp>() const;
|
||||
template <typename _Tp> CV_GPU_DEPRECATED operator PtrStep_<_Tp>() const;
|
||||
#undef CV_GPU_DEPRECATED
|
||||
|
||||
/*! includes several bit-fields:
|
||||
- the magic signature
|
||||
|
||||
@@ -104,6 +104,10 @@ CV_INLINE IppiSize ippiSize(const cv::Size & _size)
|
||||
return size;
|
||||
}
|
||||
|
||||
#if IPP_VERSION_MAJOR >= 9 // IPP 9+ is not supported
|
||||
#undef HAVE_IPP
|
||||
#undef IPP_VERSION_MAJOR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef IPPI_CALL
|
||||
@@ -292,7 +296,7 @@ namespace cv
|
||||
return classname##_info_var; \
|
||||
} \
|
||||
\
|
||||
static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
|
||||
CV_ATTR_USED static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
|
||||
\
|
||||
::cv::AlgorithmInfo* classname::info() const \
|
||||
{ \
|
||||
@@ -534,7 +538,7 @@ void func_name( T *array, size_t total, user_data_type aux )
|
||||
} \
|
||||
stack[48]; \
|
||||
\
|
||||
aux = aux; \
|
||||
(void)aux; \
|
||||
\
|
||||
if( total <= 1 ) \
|
||||
return; \
|
||||
|
||||
@@ -368,6 +368,16 @@ inline void Mat::release()
|
||||
data = datastart = dataend = datalimit = 0;
|
||||
for(int i = 0; i < dims; i++)
|
||||
size.p[i] = 0;
|
||||
#ifdef _DEBUG
|
||||
flags = MAGIC_VAL;
|
||||
dims = rows = cols = 0;
|
||||
if (step.p != step.buf)
|
||||
{
|
||||
fastFree(step.p);
|
||||
step.p = step.buf;
|
||||
size.p = &rows;
|
||||
}
|
||||
#endif
|
||||
refcount = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
/////// exchange-add operation for atomic operations on reference counters ///////
|
||||
#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32) // atomic increment on the linux version of the Intel(tm) compiler
|
||||
#define CV_XADD(addr,delta) _InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta)
|
||||
#ifdef CV_XADD
|
||||
// allow to use user-defined macro
|
||||
#elif defined __GNUC__
|
||||
|
||||
#if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
|
||||
@@ -2581,6 +2581,9 @@ template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::op
|
||||
template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
|
||||
{ return ptr; }
|
||||
|
||||
template<typename _Tp, size_t fixed_size> inline size_t AutoBuffer<_Tp, fixed_size>::getSize() const
|
||||
{ return size; }
|
||||
|
||||
|
||||
/////////////////////////////////// Ptr ////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -43,6 +43,15 @@
|
||||
#ifndef __OPENCV_CORE_TYPES_H__
|
||||
#define __OPENCV_CORE_TYPES_H__
|
||||
|
||||
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
||||
# define CV_ATTR_UNUSED __attribute__((unused))
|
||||
# define CV_ATTR_USED __attribute__((used))
|
||||
#else
|
||||
# define CV_ATTR_UNUSED
|
||||
# define CV_ATTR_USED
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER
|
||||
# if _MSC_VER > 1300
|
||||
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define CV_VERSION_EPOCH 2
|
||||
#define CV_VERSION_MAJOR 4
|
||||
#define CV_VERSION_MINOR 13
|
||||
#define CV_VERSION_REVISION 1
|
||||
#define CV_VERSION_REVISION 4
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
@@ -522,11 +522,19 @@ template<typename T> struct OpNot
|
||||
T operator()( T a, T ) const { return ~a; }
|
||||
};
|
||||
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
static inline void fixSteps(Size sz, size_t elemSize, size_t& step1, size_t& step2, size_t& step)
|
||||
{
|
||||
if( sz.height == 1 )
|
||||
step1 = step2 = step = sz.width*elemSize;
|
||||
}
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
static void add8u( const uchar* src1, size_t step1,
|
||||
const uchar* src2, size_t step2,
|
||||
|
||||
+223
-155
@@ -51,12 +51,12 @@ struct PolyEdge
|
||||
//PolyEdge(int _y0, int _y1, int _x, int _dx) : y0(_y0), y1(_y1), x(_x), dx(_dx) {}
|
||||
|
||||
int y0, y1;
|
||||
int x, dx;
|
||||
int64 x, dx;
|
||||
PolyEdge *next;
|
||||
};
|
||||
|
||||
static void
|
||||
CollectPolyEdges( Mat& img, const Point* v, int npts,
|
||||
CollectPolyEdges( Mat& img, const Point2l* v, int npts,
|
||||
vector<PolyEdge>& edges, const void* color, int line_type,
|
||||
int shift, Point offset=Point() );
|
||||
|
||||
@@ -64,11 +64,11 @@ static void
|
||||
FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color );
|
||||
|
||||
static void
|
||||
PolyLine( Mat& img, const Point* v, int npts, bool closed,
|
||||
PolyLine( Mat& img, const Point2l* v, int npts, bool closed,
|
||||
const void* color, int thickness, int line_type, int shift );
|
||||
|
||||
static void
|
||||
FillConvexPoly( Mat& img, const Point* v, int npts,
|
||||
FillConvexPoly( Mat& img, const Point2l* v, int npts,
|
||||
const void* color, int line_type, int shift );
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -77,14 +77,25 @@ FillConvexPoly( Mat& img, const Point* v, int npts,
|
||||
|
||||
bool clipLine( Size img_size, Point& pt1, Point& pt2 )
|
||||
{
|
||||
int64 x1, y1, x2, y2;
|
||||
Point2l p1(pt1.x, pt1.y);
|
||||
Point2l p2(pt2.x, pt2.y);
|
||||
bool inside = clipLine(Size2l(img_size.width, img_size.height), p1, p2);
|
||||
pt1.x = (int)p1.x;
|
||||
pt1.y = (int)p1.y;
|
||||
pt2.x = (int)p2.x;
|
||||
pt2.y = (int)p2.y;
|
||||
return inside;
|
||||
}
|
||||
|
||||
bool clipLine( Size2l img_size, Point2l& pt1, Point2l& pt2 )
|
||||
{
|
||||
int c1, c2;
|
||||
int64 right = img_size.width-1, bottom = img_size.height-1;
|
||||
|
||||
if( img_size.width <= 0 || img_size.height <= 0 )
|
||||
return false;
|
||||
|
||||
x1 = pt1.x; y1 = pt1.y; x2 = pt2.x; y2 = pt2.y;
|
||||
int64 &x1 = pt1.x, &y1 = pt1.y, &x2 = pt2.x, &y2 = pt2.y;
|
||||
c1 = (x1 < 0) + (x1 > right) * 2 + (y1 < 0) * 4 + (y1 > bottom) * 8;
|
||||
c2 = (x2 < 0) + (x2 > right) * 2 + (y2 < 0) * 4 + (y2 > bottom) * 8;
|
||||
|
||||
@@ -124,11 +135,6 @@ bool clipLine( Size img_size, Point& pt1, Point& pt2 )
|
||||
}
|
||||
|
||||
assert( (c1 & c2) != 0 || (x1 | y1 | x2 | y2) >= 0 );
|
||||
|
||||
pt1.x = (int)x1;
|
||||
pt1.y = (int)y1;
|
||||
pt2.x = (int)x2;
|
||||
pt2.y = (int)y2;
|
||||
}
|
||||
|
||||
return (c1 | c2) == 0;
|
||||
@@ -279,25 +285,25 @@ static const int FilterTable[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
LineAA( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
LineAA( Mat& img, Point2l pt1, Point2l pt2, const void* color )
|
||||
{
|
||||
int dx, dy;
|
||||
int64 dx, dy;
|
||||
int ecount, scount = 0;
|
||||
int slope;
|
||||
int ax, ay;
|
||||
int x_step, y_step;
|
||||
int i, j;
|
||||
int64 ax, ay;
|
||||
int64 x_step, y_step;
|
||||
int64 i, j;
|
||||
int ep_table[9];
|
||||
int cb = ((uchar*)color)[0], cg = ((uchar*)color)[1], cr = ((uchar*)color)[2], ca = ((uchar*)color)[3];
|
||||
int _cb, _cg, _cr, _ca;
|
||||
int nch = img.channels();
|
||||
uchar* ptr = img.data;
|
||||
size_t step = img.step;
|
||||
Size size = img.size();
|
||||
Size2l size(img.cols, img.rows);
|
||||
|
||||
if( !((nch == 1 || nch == 3 || nch == 4) && img.depth() == CV_8U) )
|
||||
{
|
||||
Line(img, pt1, pt2, color);
|
||||
Line(img, Point((int)(pt1.x<<XY_SHIFT), (int)(pt1.y<<XY_SHIFT)), Point((int)(pt2.x<<XY_SHIFT), (int)(pt2.y<<XY_SHIFT)), color);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -333,11 +339,11 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
pt1.y ^= pt2.y & j;
|
||||
|
||||
x_step = XY_ONE;
|
||||
y_step = (int) (((int64) dy << XY_SHIFT) / (ax | 1));
|
||||
y_step = (dy << XY_SHIFT) / (ax | 1);
|
||||
pt2.x += XY_ONE;
|
||||
ecount = (pt2.x >> XY_SHIFT) - (pt1.x >> XY_SHIFT);
|
||||
ecount = (int)((pt2.x >> XY_SHIFT) - (pt1.x >> XY_SHIFT));
|
||||
j = -(pt1.x & (XY_ONE - 1));
|
||||
pt1.y += (int) ((((int64) y_step) * j) >> XY_SHIFT) + (XY_ONE >> 1);
|
||||
pt1.y += ((y_step * j) >> XY_SHIFT) + (XY_ONE >> 1);
|
||||
slope = (y_step >> (XY_SHIFT - 5)) & 0x3f;
|
||||
slope ^= (y_step < 0 ? 0x3f : 0);
|
||||
|
||||
@@ -356,12 +362,12 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
pt2.y ^= pt1.y & i;
|
||||
pt1.y ^= pt2.y & i;
|
||||
|
||||
x_step = (int) (((int64) dx << XY_SHIFT) / (ay | 1));
|
||||
x_step = (dx << XY_SHIFT) / (ay | 1);
|
||||
y_step = XY_ONE;
|
||||
pt2.y += XY_ONE;
|
||||
ecount = (pt2.y >> XY_SHIFT) - (pt1.y >> XY_SHIFT);
|
||||
ecount = (int)((pt2.y >> XY_SHIFT) - (pt1.y >> XY_SHIFT));
|
||||
j = -(pt1.y & (XY_ONE - 1));
|
||||
pt1.x += (int) ((((int64) x_step) * j) >> XY_SHIFT) + (XY_ONE >> 1);
|
||||
pt1.x += ((x_step * j) >> XY_SHIFT) + (XY_ONE >> 1);
|
||||
slope = (x_step >> (XY_SHIFT - 5)) & 0x3f;
|
||||
slope ^= (x_step < 0 ? 0x3f : 0);
|
||||
|
||||
@@ -375,8 +381,8 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
/* Calc end point correction table */
|
||||
{
|
||||
int t0 = slope << 7;
|
||||
int t1 = ((0x78 - i) | 4) * slope;
|
||||
int t2 = (j | 4) * slope;
|
||||
int t1 = ((0x78 - (int)i) | 4) * slope;
|
||||
int t2 = ((int)j | 4) * slope;
|
||||
|
||||
ep_table[0] = 0;
|
||||
ep_table[8] = slope;
|
||||
@@ -630,23 +636,25 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
|
||||
static void
|
||||
Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
Line2( Mat& img, Point2l pt1, Point2l pt2, const void* color)
|
||||
{
|
||||
int dx, dy;
|
||||
int64 dx, dy;
|
||||
int ecount;
|
||||
int ax, ay;
|
||||
int i, j, x, y;
|
||||
int x_step, y_step;
|
||||
int64 ax, ay;
|
||||
int64 i, j;
|
||||
int x, y;
|
||||
int64 x_step, y_step;
|
||||
int cb = ((uchar*)color)[0];
|
||||
int cg = ((uchar*)color)[1];
|
||||
int cr = ((uchar*)color)[2];
|
||||
int pix_size = (int)img.elemSize();
|
||||
uchar *ptr = img.data, *tptr;
|
||||
size_t step = img.step;
|
||||
Size size = img.size(), sizeScaled(size.width*XY_ONE, size.height*XY_ONE);
|
||||
Size size = img.size();
|
||||
|
||||
//assert( img && (nch == 1 || nch == 3) && img.depth() == CV_8U );
|
||||
|
||||
Size2l sizeScaled(((int64)size.width) << XY_SHIFT, ((int64)size.height) << XY_SHIFT);
|
||||
if( !clipLine( sizeScaled, pt1, pt2 ))
|
||||
return;
|
||||
|
||||
@@ -670,8 +678,8 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
pt1.y ^= pt2.y & j;
|
||||
|
||||
x_step = XY_ONE;
|
||||
y_step = (int) (((int64) dy << XY_SHIFT) / (ax | 1));
|
||||
ecount = (pt2.x - pt1.x) >> XY_SHIFT;
|
||||
y_step = (dy << XY_SHIFT) / (ax | 1);
|
||||
ecount = (int)((pt2.x - pt1.x) >> XY_SHIFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -684,9 +692,9 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
pt2.y ^= pt1.y & i;
|
||||
pt1.y ^= pt2.y & i;
|
||||
|
||||
x_step = (int) (((int64) dx << XY_SHIFT) / (ay | 1));
|
||||
x_step = (dx << XY_SHIFT) / (ay | 1);
|
||||
y_step = XY_ONE;
|
||||
ecount = (pt2.y - pt1.y) >> XY_SHIFT;
|
||||
ecount = (int)((pt2.y - pt1.y) >> XY_SHIFT);
|
||||
}
|
||||
|
||||
pt1.x += (XY_ONE >> 1);
|
||||
@@ -705,8 +713,8 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
tptr[2] = (uchar)cr; \
|
||||
}
|
||||
|
||||
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
|
||||
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT),
|
||||
(int)((pt2.y + (XY_ONE >> 1)) >> XY_SHIFT));
|
||||
|
||||
if( ax > ay )
|
||||
{
|
||||
@@ -714,7 +722,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x, pt1.y >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)(pt1.x), (int)(pt1.y >> XY_SHIFT));
|
||||
pt1.x++;
|
||||
pt1.y += y_step;
|
||||
ecount--;
|
||||
@@ -726,7 +734,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
|
||||
ICV_PUT_POINT((int)(pt1.x >> XY_SHIFT), (int)(pt1.y));
|
||||
pt1.x += x_step;
|
||||
pt1.y++;
|
||||
ecount--;
|
||||
@@ -746,8 +754,8 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
tptr[0] = (uchar)cb; \
|
||||
}
|
||||
|
||||
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
|
||||
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT),
|
||||
(int)((pt2.y + (XY_ONE >> 1)) >> XY_SHIFT));
|
||||
|
||||
if( ax > ay )
|
||||
{
|
||||
@@ -755,7 +763,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x, pt1.y >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)(pt1.x), (int)(pt1.y >> XY_SHIFT));
|
||||
pt1.x++;
|
||||
pt1.y += y_step;
|
||||
ecount--;
|
||||
@@ -767,7 +775,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
|
||||
ICV_PUT_POINT((int)(pt1.x >> XY_SHIFT), (int)(pt1.y));
|
||||
pt1.x += x_step;
|
||||
pt1.y++;
|
||||
ecount--;
|
||||
@@ -788,8 +796,8 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
tptr[j] = ((uchar*)color)[j]; \
|
||||
}
|
||||
|
||||
ICV_PUT_POINT((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT,
|
||||
(pt2.y + (XY_ONE >> 1)) >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)((pt2.x + (XY_ONE >> 1)) >> XY_SHIFT),
|
||||
(int)((pt2.y + (XY_ONE >> 1)) >> XY_SHIFT));
|
||||
|
||||
if( ax > ay )
|
||||
{
|
||||
@@ -797,7 +805,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x, pt1.y >> XY_SHIFT);
|
||||
ICV_PUT_POINT((int)(pt1.x), (int)(pt1.y >> XY_SHIFT));
|
||||
pt1.x++;
|
||||
pt1.y += y_step;
|
||||
ecount--;
|
||||
@@ -809,7 +817,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
|
||||
|
||||
while( ecount >= 0 )
|
||||
{
|
||||
ICV_PUT_POINT(pt1.x >> XY_SHIFT, pt1.y);
|
||||
ICV_PUT_POINT((int)(pt1.x >> XY_SHIFT), (int)(pt1.y));
|
||||
pt1.x += x_step;
|
||||
pt1.y++;
|
||||
ecount--;
|
||||
@@ -917,13 +925,35 @@ sincos( int angle, float& cosval, float& sinval )
|
||||
constructs polygon that represents elliptic arc.
|
||||
*/
|
||||
void ellipse2Poly( Point center, Size axes, int angle,
|
||||
int arcStart, int arcEnd,
|
||||
int delta, CV_OUT std::vector<Point>& pts )
|
||||
{
|
||||
vector<Point2d> _pts;
|
||||
ellipse2Poly(Point2d(center.x, center.y), Size2d(axes.width, axes.height), angle,
|
||||
arcStart, arcEnd, delta, _pts);
|
||||
Point prevPt(INT_MIN, INT_MIN);
|
||||
pts.resize(0);
|
||||
for (unsigned int i = 0; i < _pts.size(); ++i)
|
||||
{
|
||||
Point pt;
|
||||
pt.x = cvRound(_pts[i].x);
|
||||
pt.y = cvRound(_pts[i].y);
|
||||
if (pt != prevPt) {
|
||||
pts.push_back(pt);
|
||||
prevPt = pt;
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no points, it's a zero-size polygon
|
||||
if( pts.size() == 1 )
|
||||
pts.push_back(pts[0]);
|
||||
}
|
||||
|
||||
void ellipse2Poly( Point2d center, Size2d axes, int angle,
|
||||
int arc_start, int arc_end,
|
||||
int delta, vector<Point>& pts )
|
||||
int delta, vector<Point2d>& pts )
|
||||
{
|
||||
float alpha, beta;
|
||||
double size_a = axes.width, size_b = axes.height;
|
||||
double cx = center.x, cy = center.y;
|
||||
Point prevPt(INT_MIN,INT_MIN);
|
||||
int i;
|
||||
|
||||
while( angle < 0 )
|
||||
@@ -964,15 +994,12 @@ void ellipse2Poly( Point center, Size axes, int angle,
|
||||
if( angle < 0 )
|
||||
angle += 360;
|
||||
|
||||
x = size_a * SinTable[450-angle];
|
||||
y = size_b * SinTable[angle];
|
||||
Point pt;
|
||||
pt.x = cvRound( cx + x * alpha - y * beta );
|
||||
pt.y = cvRound( cy + x * beta + y * alpha );
|
||||
if( pt != prevPt ){
|
||||
pts.push_back(pt);
|
||||
prevPt = pt;
|
||||
}
|
||||
x = axes.width * SinTable[450-angle];
|
||||
y = axes.height * SinTable[angle];
|
||||
Point2d pt;
|
||||
pt.x = center.x + x * alpha - y * beta;
|
||||
pt.y = center.y + x * beta + y * alpha;
|
||||
pts.push_back(pt);
|
||||
}
|
||||
|
||||
if( pts.size() == 1 )
|
||||
@@ -981,16 +1008,37 @@ void ellipse2Poly( Point center, Size axes, int angle,
|
||||
|
||||
|
||||
static void
|
||||
EllipseEx( Mat& img, Point center, Size axes,
|
||||
EllipseEx( Mat& img, Point2l center, Size2l axes,
|
||||
int angle, int arc_start, int arc_end,
|
||||
const void* color, int thickness, int line_type )
|
||||
{
|
||||
axes.width = std::abs(axes.width), axes.height = std::abs(axes.height);
|
||||
int delta = (std::max(axes.width,axes.height)+(XY_ONE>>1))>>XY_SHIFT;
|
||||
int delta = (int)((std::max(axes.width,axes.height)+(XY_ONE>>1))>>XY_SHIFT);
|
||||
delta = delta < 3 ? 90 : delta < 10 ? 30 : delta < 15 ? 18 : 5;
|
||||
|
||||
vector<Point> v;
|
||||
ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, v );
|
||||
vector<Point2d> _v;
|
||||
ellipse2Poly( Point2d((double)center.x, (double)center.y), Size2d((double)axes.width, (double)axes.height), angle, arc_start, arc_end, delta, _v );
|
||||
|
||||
vector<Point2l> v;
|
||||
Point2l prevPt(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF);
|
||||
v.resize(0);
|
||||
for (unsigned int i = 0; i < _v.size(); ++i)
|
||||
{
|
||||
Point2l pt;
|
||||
pt.x = (int64)cvRound(_v[i].x / XY_ONE) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / XY_ONE) << XY_SHIFT;
|
||||
pt.x += cvRound(_v[i].x - pt.x);
|
||||
pt.y += cvRound(_v[i].y - pt.y);
|
||||
if (pt != prevPt) {
|
||||
v.push_back(pt);
|
||||
prevPt = pt;
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no points, it's a zero-size polygon
|
||||
if (v.size() == 1) {
|
||||
v.assign(2, center);
|
||||
}
|
||||
|
||||
if( thickness >= 0 )
|
||||
PolyLine( img, &v[0], (int)v.size(), false, color, thickness, line_type, XY_SHIFT );
|
||||
@@ -1029,23 +1077,24 @@ EllipseEx( Mat& img, Point center, Size axes,
|
||||
|
||||
/* filling convex polygon. v - array of vertices, ntps - number of points */
|
||||
static void
|
||||
FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_type, int shift )
|
||||
FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int line_type, int shift )
|
||||
{
|
||||
struct
|
||||
{
|
||||
int idx, di;
|
||||
int x, dx, ye;
|
||||
int64 x, dx;
|
||||
int ye;
|
||||
}
|
||||
edge[2];
|
||||
|
||||
int delta = shift ? 1 << (shift - 1) : 0;
|
||||
int i, y, imin = 0, left = 0, right = 1, x1, x2;
|
||||
int delta = 1 << shift >> 1;
|
||||
int i, y, imin = 0, left = 0, right = 1;
|
||||
int edges = npts;
|
||||
int xmin, xmax, ymin, ymax;
|
||||
int64 xmin, xmax, ymin, ymax;
|
||||
uchar* ptr = img.data;
|
||||
Size size = img.size();
|
||||
int pix_size = (int)img.elemSize();
|
||||
Point p0;
|
||||
Point2l p0;
|
||||
int delta1, delta2;
|
||||
|
||||
if( line_type < CV_AA )
|
||||
@@ -1063,7 +1112,7 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
|
||||
for( i = 0; i < npts; i++ )
|
||||
{
|
||||
Point p = v[i];
|
||||
Point2l p = v[i];
|
||||
if( p.y < ymin )
|
||||
{
|
||||
ymin = p.y;
|
||||
@@ -1082,10 +1131,10 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
if( shift == 0 )
|
||||
{
|
||||
Point pt0, pt1;
|
||||
pt0.x = p0.x >> XY_SHIFT;
|
||||
pt0.y = p0.y >> XY_SHIFT;
|
||||
pt1.x = p.x >> XY_SHIFT;
|
||||
pt1.y = p.y >> XY_SHIFT;
|
||||
pt0.x = (int)(p0.x >> XY_SHIFT);
|
||||
pt0.y = (int)(p0.y >> XY_SHIFT);
|
||||
pt1.x = (int)(p.x >> XY_SHIFT);
|
||||
pt1.y = (int)(p.y >> XY_SHIFT);
|
||||
Line( img, pt0, pt1, color, line_type );
|
||||
}
|
||||
else
|
||||
@@ -1101,13 +1150,13 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
ymin = (ymin + delta) >> shift;
|
||||
ymax = (ymax + delta) >> shift;
|
||||
|
||||
if( npts < 3 || xmax < 0 || ymax < 0 || xmin >= size.width || ymin >= size.height )
|
||||
if( npts < 3 || (int)xmax < 0 || (int)ymax < 0 || (int)xmin >= size.width || (int)ymin >= size.height )
|
||||
return;
|
||||
|
||||
ymax = MIN( ymax, size.height - 1 );
|
||||
edge[0].idx = edge[1].idx = imin;
|
||||
|
||||
edge[0].ye = edge[1].ye = y = ymin;
|
||||
edge[0].ye = edge[1].ye = y = (int)ymin;
|
||||
edge[0].di = 1;
|
||||
edge[1].di = npts - 1;
|
||||
|
||||
@@ -1115,18 +1164,19 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
|
||||
do
|
||||
{
|
||||
if( line_type < CV_AA || y < ymax || y == ymin )
|
||||
if( line_type < CV_AA || y < (int)ymax || y == (int)ymin )
|
||||
{
|
||||
for( i = 0; i < 2; i++ )
|
||||
{
|
||||
if( y >= edge[i].ye )
|
||||
{
|
||||
int idx = edge[i].idx, di = edge[i].di;
|
||||
int xs = 0, xe, ye, ty = 0;
|
||||
int64 xs = 0, xe;
|
||||
int ty = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
ty = (v[idx].y + delta) >> shift;
|
||||
ty = (int)((v[idx].y + delta) >> shift);
|
||||
if( ty > y || edges == 0 )
|
||||
break;
|
||||
xs = v[idx].x;
|
||||
@@ -1135,16 +1185,19 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
edges--;
|
||||
}
|
||||
|
||||
ye = ty;
|
||||
xs <<= XY_SHIFT - shift;
|
||||
xe = v[idx].x << (XY_SHIFT - shift);
|
||||
xe = v[idx].x;
|
||||
if (XY_SHIFT - shift != 0)
|
||||
{
|
||||
xs <<= XY_SHIFT - shift;
|
||||
xe <<= XY_SHIFT - shift;
|
||||
}
|
||||
|
||||
/* no more edges */
|
||||
if( y >= ye )
|
||||
if( y >= ty)
|
||||
return;
|
||||
|
||||
edge[i].ye = ye;
|
||||
edge[i].dx = ((xe - xs)*2 + (ye - y)) / (2 * (ye - y));
|
||||
edge[i].ye = ty;
|
||||
edge[i].dx = ((xe - xs)*2 + (ty - y)) / (2 * (ty - y));
|
||||
edge[i].x = xs;
|
||||
edge[i].idx = idx;
|
||||
}
|
||||
@@ -1157,13 +1210,10 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
right ^= 1;
|
||||
}
|
||||
|
||||
x1 = edge[left].x;
|
||||
x2 = edge[right].x;
|
||||
|
||||
if( y >= 0 )
|
||||
{
|
||||
int xx1 = (x1 + delta1) >> XY_SHIFT;
|
||||
int xx2 = (x2 + delta2) >> XY_SHIFT;
|
||||
int xx1 = (int)((edge[left].x + delta1) >> XY_SHIFT);
|
||||
int xx2 = (int)((edge[right].x + delta2) >> XY_SHIFT);
|
||||
|
||||
if( xx2 >= 0 && xx1 < size.width )
|
||||
{
|
||||
@@ -1175,25 +1225,22 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
}
|
||||
}
|
||||
|
||||
x1 += edge[left].dx;
|
||||
x2 += edge[right].dx;
|
||||
|
||||
edge[left].x = x1;
|
||||
edge[right].x = x2;
|
||||
edge[left].x += edge[left].dx;
|
||||
edge[right].x += edge[right].dx;
|
||||
ptr += img.step;
|
||||
}
|
||||
while( ++y <= ymax );
|
||||
while( ++y <= (int)ymax );
|
||||
}
|
||||
|
||||
|
||||
/******** Arbitrary polygon **********/
|
||||
|
||||
static void
|
||||
CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
|
||||
CollectPolyEdges( Mat& img, const Point2l* v, int count, vector<PolyEdge>& edges,
|
||||
const void* color, int line_type, int shift, Point offset )
|
||||
{
|
||||
int i, delta = offset.y + (shift ? 1 << (shift - 1) : 0);
|
||||
Point pt0 = v[count-1], pt1;
|
||||
int i, delta = offset.y + ((1 << shift) >> 1);
|
||||
Point2l pt0 = v[count-1], pt1;
|
||||
pt0.x = (pt0.x + offset.x) << (XY_SHIFT - shift);
|
||||
pt0.y = (pt0.y + delta) >> shift;
|
||||
|
||||
@@ -1201,7 +1248,7 @@ CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
|
||||
|
||||
for( i = 0; i < count; i++, pt0 = pt1 )
|
||||
{
|
||||
Point t0, t1;
|
||||
Point2l t0, t1;
|
||||
PolyEdge edge;
|
||||
|
||||
pt1 = v[i];
|
||||
@@ -1213,7 +1260,7 @@ CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
|
||||
t0.y = pt0.y; t1.y = pt1.y;
|
||||
t0.x = (pt0.x + (XY_ONE >> 1)) >> XY_SHIFT;
|
||||
t1.x = (pt1.x + (XY_ONE >> 1)) >> XY_SHIFT;
|
||||
Line( img, t0, t1, color, line_type );
|
||||
Line( img, Point((int)(t0.x), (int)(t0.y)), Point((int)(t1.x), (int)(t1.y)), color, line_type );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1228,14 +1275,14 @@ CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
|
||||
|
||||
if( pt0.y < pt1.y )
|
||||
{
|
||||
edge.y0 = pt0.y;
|
||||
edge.y1 = pt1.y;
|
||||
edge.y0 = (int)(pt0.y);
|
||||
edge.y1 = (int)(pt1.y);
|
||||
edge.x = pt0.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.y0 = pt1.y;
|
||||
edge.y1 = pt0.y;
|
||||
edge.y0 = (int)(pt1.y);
|
||||
edge.y1 = (int)(pt0.y);
|
||||
edge.x = pt1.x;
|
||||
}
|
||||
edge.dx = (pt1.x - pt0.x) / (pt1.y - pt0.y);
|
||||
@@ -1261,7 +1308,8 @@ FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
|
||||
int i, y, total = (int)edges.size();
|
||||
Size size = img.size();
|
||||
PolyEdge* e;
|
||||
int y_max = INT_MIN, x_max = INT_MIN, y_min = INT_MAX, x_min = INT_MAX;
|
||||
int y_max = INT_MIN, y_min = INT_MAX;
|
||||
int64 x_max = 0xFFFFFFFFFFFFFFFF, x_min = 0x7FFFFFFFFFFFFFFF;
|
||||
int pix_size = (int)img.elemSize();
|
||||
|
||||
if( total < 2 )
|
||||
@@ -1273,7 +1321,7 @@ FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
|
||||
assert( e1.y0 < e1.y1 );
|
||||
// Determine x-coordinate of the end of the edge.
|
||||
// (This is not necessary x-coordinate of any vertex in the array.)
|
||||
int x1 = e1.x + (e1.y1 - e1.y0) * e1.dx;
|
||||
int64 x1 = e1.x + (e1.y1 - e1.y0) * e1.dx;
|
||||
y_min = std::min( y_min, e1.y0 );
|
||||
y_max = std::max( y_max, e1.y1 );
|
||||
x_min = std::min( x_min, e1.x );
|
||||
@@ -1282,7 +1330,7 @@ FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
|
||||
x_max = std::max( x_max, x1 );
|
||||
}
|
||||
|
||||
if( y_max < 0 || y_min >= size.height || x_max < 0 || x_min >= (size.width<<XY_SHIFT) )
|
||||
if( y_max < 0 || y_min >= size.height || x_max < 0 || x_min >= ((int64)size.width<<XY_SHIFT) )
|
||||
return;
|
||||
|
||||
std::sort( edges.begin(), edges.end(), CmpEdges() );
|
||||
@@ -1338,19 +1386,18 @@ FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
|
||||
{
|
||||
// convert x's from fixed-point to image coordinates
|
||||
uchar *timg = img.data + y * img.step;
|
||||
int x1 = keep_prelast->x;
|
||||
int x2 = prelast->x;
|
||||
int x1, x2;
|
||||
|
||||
if( x1 > x2 )
|
||||
if (keep_prelast->x > prelast->x)
|
||||
{
|
||||
int t = x1;
|
||||
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
x1 = (int)((prelast->x + XY_ONE - 1) >> XY_SHIFT);
|
||||
x2 = (int)(keep_prelast->x >> XY_SHIFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = (int)((keep_prelast->x + XY_ONE - 1) >> XY_SHIFT);
|
||||
x2 = (int)(prelast->x >> XY_SHIFT);
|
||||
}
|
||||
|
||||
x1 = (x1 + XY_ONE - 1) >> XY_SHIFT;
|
||||
x2 = x2 >> XY_SHIFT;
|
||||
|
||||
// clip and draw the line
|
||||
if( x1 < size.width && x2 >= 0 )
|
||||
@@ -1550,7 +1597,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
|
||||
|
||||
|
||||
static void
|
||||
ThickLine( Mat& img, Point p0, Point p1, const void* color,
|
||||
ThickLine( Mat& img, Point2l p0, Point2l p1, const void* color,
|
||||
int thickness, int line_type, int flags, int shift )
|
||||
{
|
||||
static const double INV_XY_ONE = 1./XY_ONE;
|
||||
@@ -1570,7 +1617,7 @@ ThickLine( Mat& img, Point p0, Point p1, const void* color,
|
||||
p0.y = (p0.y + (XY_ONE>>1)) >> XY_SHIFT;
|
||||
p1.x = (p1.x + (XY_ONE>>1)) >> XY_SHIFT;
|
||||
p1.y = (p1.y + (XY_ONE>>1)) >> XY_SHIFT;
|
||||
Line( img, p0, p1, color, line_type );
|
||||
Line( img, Point((int)(p0.x), (int)(p0.y)), Point((int)(p1.x), (int)(p1.y)), color, line_type );
|
||||
}
|
||||
else
|
||||
Line2( img, p0, p1, color );
|
||||
@@ -1580,7 +1627,7 @@ ThickLine( Mat& img, Point p0, Point p1, const void* color,
|
||||
}
|
||||
else
|
||||
{
|
||||
Point pt[4], dp = Point(0,0);
|
||||
Point2l pt[4], dp = Point2l(0,0);
|
||||
double dx = (p0.x - p1.x)*INV_XY_ONE, dy = (p1.y - p0.y)*INV_XY_ONE;
|
||||
double r = dx * dx + dy * dy;
|
||||
int i, oddThickness = thickness & 1;
|
||||
@@ -1611,13 +1658,13 @@ ThickLine( Mat& img, Point p0, Point p1, const void* color,
|
||||
if( line_type < CV_AA )
|
||||
{
|
||||
Point center;
|
||||
center.x = (p0.x + (XY_ONE>>1)) >> XY_SHIFT;
|
||||
center.y = (p0.y + (XY_ONE>>1)) >> XY_SHIFT;
|
||||
center.x = (int)((p0.x + (XY_ONE>>1)) >> XY_SHIFT);
|
||||
center.y = (int)((p0.y + (XY_ONE>>1)) >> XY_SHIFT);
|
||||
Circle( img, center, (thickness + (XY_ONE>>1)) >> XY_SHIFT, color, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EllipseEx( img, p0, cvSize(thickness, thickness),
|
||||
EllipseEx( img, p0, Size2l(thickness, thickness),
|
||||
0, 0, 360, color, -1, line_type );
|
||||
}
|
||||
}
|
||||
@@ -1628,7 +1675,7 @@ ThickLine( Mat& img, Point p0, Point p1, const void* color,
|
||||
|
||||
|
||||
static void
|
||||
PolyLine( Mat& img, const Point* v, int count, bool is_closed,
|
||||
PolyLine( Mat& img, const Point2l* v, int count, bool is_closed,
|
||||
const void* color, int thickness,
|
||||
int line_type, int shift )
|
||||
{
|
||||
@@ -1637,13 +1684,13 @@ PolyLine( Mat& img, const Point* v, int count, bool is_closed,
|
||||
|
||||
int i = is_closed ? count - 1 : 0;
|
||||
int flags = 2 + !is_closed;
|
||||
Point p0;
|
||||
Point2l p0;
|
||||
CV_Assert( 0 <= shift && shift <= XY_SHIFT && thickness >= 0 );
|
||||
|
||||
p0 = v[i];
|
||||
for( i = !is_closed; i < count; i++ )
|
||||
{
|
||||
Point p = v[i];
|
||||
Point2l p = v[i];
|
||||
ThickLine( img, p0, p, color, thickness, line_type, flags, shift );
|
||||
p0 = p;
|
||||
flags = 2;
|
||||
@@ -1700,7 +1747,7 @@ void rectangle( Mat& img, Point pt1, Point pt2,
|
||||
double buf[4];
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
|
||||
Point pt[4];
|
||||
Point2l pt[4];
|
||||
|
||||
pt[0] = pt1;
|
||||
pt[1].x = pt2.x;
|
||||
@@ -1741,10 +1788,12 @@ void circle( Mat& img, Point center, int radius,
|
||||
|
||||
if( thickness > 1 || line_type >= CV_AA || shift > 0 )
|
||||
{
|
||||
center.x <<= XY_SHIFT - shift;
|
||||
center.y <<= XY_SHIFT - shift;
|
||||
radius <<= XY_SHIFT - shift;
|
||||
EllipseEx( img, center, Size(radius, radius),
|
||||
Point2l _center(center.x, center.y);
|
||||
int64 _radius(radius);
|
||||
_center.x <<= XY_SHIFT - shift;
|
||||
_center.y <<= XY_SHIFT - shift;
|
||||
_radius <<= XY_SHIFT - shift;
|
||||
EllipseEx( img, _center, Size2l(_radius, _radius),
|
||||
0, 0, 360, buf, thickness, line_type );
|
||||
}
|
||||
else
|
||||
@@ -1768,12 +1817,14 @@ void ellipse( Mat& img, Point center, Size axes,
|
||||
int _angle = cvRound(angle);
|
||||
int _start_angle = cvRound(start_angle);
|
||||
int _end_angle = cvRound(end_angle);
|
||||
center.x <<= XY_SHIFT - shift;
|
||||
center.y <<= XY_SHIFT - shift;
|
||||
axes.width <<= XY_SHIFT - shift;
|
||||
axes.height <<= XY_SHIFT - shift;
|
||||
Point2l _center(center.x, center.y);
|
||||
Size2l _axes(axes.width, axes.height);
|
||||
_center.x <<= XY_SHIFT - shift;
|
||||
_center.y <<= XY_SHIFT - shift;
|
||||
_axes.width <<= XY_SHIFT - shift;
|
||||
_axes.height <<= XY_SHIFT - shift;
|
||||
|
||||
EllipseEx( img, center, axes, _angle, _start_angle,
|
||||
EllipseEx( img, _center, _axes, _angle, _start_angle,
|
||||
_end_angle, buf, thickness, line_type );
|
||||
}
|
||||
|
||||
@@ -1790,10 +1841,14 @@ void ellipse(Mat& img, const RotatedRect& box, const Scalar& color,
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
|
||||
int _angle = cvRound(box.angle);
|
||||
Point center(cvRound(box.center.x*(1 << XY_SHIFT)),
|
||||
cvRound(box.center.y*(1 << XY_SHIFT)));
|
||||
Size axes(cvRound(box.size.width*(1 << (XY_SHIFT - 1))),
|
||||
cvRound(box.size.height*(1 << (XY_SHIFT - 1))));
|
||||
Point2l center(cvRound(box.center.x),
|
||||
cvRound(box.center.y));
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*XY_ONE);
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*XY_ONE);
|
||||
Size2l axes(cvRound(box.size.width),
|
||||
cvRound(box.size.height));
|
||||
axes.width = (axes.width << (XY_SHIFT - 1)) + cvRound((box.size.width - axes.width)*(XY_ONE>>1));
|
||||
axes.height = (axes.height << (XY_SHIFT - 1)) + cvRound((box.size.height - axes.height)*(XY_ONE>>1));
|
||||
EllipseEx( img, center, axes, _angle, 0, 360, buf, thickness, lineType );
|
||||
}
|
||||
|
||||
@@ -1845,7 +1900,7 @@ void drawMarker(Mat& img, Point position, const Scalar& color, int markerType, i
|
||||
case MARKER_TRIANGLE_UP:
|
||||
line(img, Point(position.x-(markerSize/2), position.y+(markerSize/2)), Point(position.x+(markerSize/2), position.y+(markerSize/2)), color, thickness, line_type);
|
||||
line(img, Point(position.x+(markerSize/2), position.y+(markerSize/2)), Point(position.x, position.y-(markerSize/2)), color, thickness, line_type);
|
||||
line(img, Point(position.x, position.y-(markerSize/2)), Point(position.x-(markerSize/2), position.y-(markerSize/2)), color, thickness, line_type);
|
||||
line(img, Point(position.x, position.y-(markerSize/2)), Point(position.x-(markerSize/2), position.y+(markerSize/2)), color, thickness, line_type);
|
||||
break;
|
||||
|
||||
// The triangle down marker case
|
||||
@@ -1876,7 +1931,10 @@ void fillConvexPoly( Mat& img, const Point* pts, int npts,
|
||||
double buf[4];
|
||||
CV_Assert( 0 <= shift && shift <= XY_SHIFT );
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
FillConvexPoly( img, pts, npts, buf, line_type, shift );
|
||||
vector<Point2l> _pts;
|
||||
for( int n = 0; n < npts; n++ )
|
||||
_pts.push_back(Point2l(pts[n].x, pts[n].y));
|
||||
FillConvexPoly( img, _pts.data(), npts, buf, line_type, shift );
|
||||
}
|
||||
|
||||
|
||||
@@ -1900,7 +1958,12 @@ void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours,
|
||||
|
||||
edges.reserve( total + 1 );
|
||||
for( i = 0; i < ncontours; i++ )
|
||||
CollectPolyEdges( img, pts[i], npts[i], edges, buf, line_type, shift, offset );
|
||||
{
|
||||
vector<Point2l> _pts;
|
||||
for( int n = 0; n < npts[i]; n++ )
|
||||
_pts.push_back(Point2l(pts[i][n].x, pts[i][n].y));
|
||||
CollectPolyEdges( img, _pts.data(), npts[i], edges, buf, line_type, shift, offset );
|
||||
}
|
||||
|
||||
FillEdgeCollection(img, edges, buf);
|
||||
}
|
||||
@@ -1920,7 +1983,12 @@ void polylines( Mat& img, const Point** pts, const int* npts, int ncontours, boo
|
||||
scalarToRawData( color, buf, img.type(), 0 );
|
||||
|
||||
for( int i = 0; i < ncontours; i++ )
|
||||
PolyLine( img, pts[i], npts[i], isClosed, buf, thickness, line_type, shift );
|
||||
{
|
||||
vector<Point2l> _pts;
|
||||
for( int n = 0; n < npts[i]; n++ )
|
||||
_pts.push_back(Point2l(pts[i][n].x, pts[i][n].y));
|
||||
PolyLine( img, _pts.data(), npts[i], isClosed, buf, thickness, line_type, shift );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2156,23 +2224,23 @@ void putText( Mat& img, const string& text, Point org,
|
||||
if( bottomLeftOrigin )
|
||||
vscale = -vscale;
|
||||
|
||||
int view_x = org.x << XY_SHIFT;
|
||||
int view_y = (org.y << XY_SHIFT) + base_line*vscale;
|
||||
vector<Point> pts;
|
||||
int64 view_x = (int64)org.x << XY_SHIFT;
|
||||
int64 view_y = ((int64)org.y << XY_SHIFT) + base_line*vscale;
|
||||
vector<Point2l> pts;
|
||||
pts.reserve(1 << 10);
|
||||
const char **faces = cv::g_HersheyGlyphs;
|
||||
|
||||
for( int i = 0; i < (int)text.size(); i++ )
|
||||
{
|
||||
int c = (uchar)text[i];
|
||||
Point p;
|
||||
Point2l p;
|
||||
|
||||
readCheck(c, i, text, fontFace);
|
||||
|
||||
const char* ptr = faces[ascii[(c-' ')+1]];
|
||||
p.x = (uchar)ptr[0] - 'R';
|
||||
p.y = (uchar)ptr[1] - 'R';
|
||||
int dx = p.y*hscale;
|
||||
int64 dx = p.y*hscale;
|
||||
view_x -= p.x*hscale;
|
||||
pts.resize(0);
|
||||
|
||||
@@ -2191,7 +2259,7 @@ void putText( Mat& img, const string& text, Point org,
|
||||
p.x = (uchar)ptr[0] - 'R';
|
||||
p.y = (uchar)ptr[1] - 'R';
|
||||
ptr += 2;
|
||||
pts.push_back(Point(p.x*hscale + view_x, p.y*vscale + view_y));
|
||||
pts.push_back(Point2l(p.x*hscale + view_x, p.y*vscale + view_y));
|
||||
}
|
||||
}
|
||||
view_x += dx;
|
||||
@@ -2310,7 +2378,7 @@ cvDrawContours( void* _img, CvSeq* contour,
|
||||
CvSeq *contour0 = contour, *h_next = 0;
|
||||
CvTreeNodeIterator iterator;
|
||||
cv::vector<cv::PolyEdge> edges;
|
||||
cv::vector<cv::Point> pts;
|
||||
cv::vector<cv::Point2l> pts;
|
||||
cv::Scalar externalColor = _externalColor, holeColor = _holeColor;
|
||||
cv::Mat img = cv::cvarrToMat(_img);
|
||||
cv::Point offset = _offset;
|
||||
@@ -2434,7 +2502,7 @@ cvEllipse2Poly( CvPoint center, CvSize axes, int angle,
|
||||
int arc_start, int arc_end, CvPoint* _pts, int delta )
|
||||
{
|
||||
cv::vector<cv::Point> pts;
|
||||
cv::ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, pts );
|
||||
cv::ellipse2Poly( cv::Point(center), cv::Size(axes), angle, arc_start, arc_end, delta, pts );
|
||||
memcpy( _pts, &pts[0], pts.size()*sizeof(_pts[0]) );
|
||||
return (int)pts.size();
|
||||
}
|
||||
|
||||
+141
-130
@@ -1891,13 +1891,131 @@ void cv::idft( InputArray src, OutputArray dst, int flags, int nonzero_rows )
|
||||
dft( src, dst, flags | DFT_INVERSE, nonzero_rows );
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
#define VAL(buf, elem) (((T*)((char*)data ## buf + (step ## buf * (elem))))[0])
|
||||
#define MUL_SPECTRUMS_COL(A, B, C) \
|
||||
VAL(C, 0) = VAL(A, 0) * VAL(B, 0); \
|
||||
for (size_t j = 1; j <= rows - 2; j += 2) \
|
||||
{ \
|
||||
double a_re = VAL(A, j), a_im = VAL(A, j + 1); \
|
||||
double b_re = VAL(B, j), b_im = VAL(B, j + 1); \
|
||||
if (conjB) b_im = -b_im; \
|
||||
double c_re = a_re * b_re - a_im * b_im; \
|
||||
double c_im = a_re * b_im + a_im * b_re; \
|
||||
VAL(C, j) = (T)c_re; VAL(C, j + 1) = (T)c_im; \
|
||||
} \
|
||||
if ((rows & 1) == 0) \
|
||||
VAL(C, rows-1) = VAL(A, rows-1) * VAL(B, rows-1)
|
||||
|
||||
template <typename T, bool conjB> static inline
|
||||
void mulSpectrums_processCol_noinplace(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows)
|
||||
{
|
||||
MUL_SPECTRUMS_COL(A, B, C);
|
||||
}
|
||||
|
||||
template <typename T, bool conjB> static inline
|
||||
void mulSpectrums_processCol_inplaceA(const T* dataB, T* dataAC, size_t stepB, size_t stepAC, size_t rows)
|
||||
{
|
||||
MUL_SPECTRUMS_COL(AC, B, AC);
|
||||
}
|
||||
template <typename T, bool conjB, bool inplaceA> static inline
|
||||
void mulSpectrums_processCol(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows)
|
||||
{
|
||||
if (inplaceA)
|
||||
mulSpectrums_processCol_inplaceA<T, conjB>(dataB, dataC, stepB, stepC, rows);
|
||||
else
|
||||
mulSpectrums_processCol_noinplace<T, conjB>(dataA, dataB, dataC, stepA, stepB, stepC, rows);
|
||||
}
|
||||
#undef MUL_SPECTRUMS_COL
|
||||
#undef VAL
|
||||
|
||||
template <typename T, bool conjB, bool inplaceA> static inline
|
||||
void mulSpectrums_processCols(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows, size_t cols)
|
||||
{
|
||||
mulSpectrums_processCol<T, conjB, inplaceA>(dataA, dataB, dataC, stepA, stepB, stepC, rows);
|
||||
if ((cols & 1) == 0)
|
||||
{
|
||||
mulSpectrums_processCol<T, conjB, inplaceA>(dataA + cols - 1, dataB + cols - 1, dataC + cols - 1, stepA, stepB, stepC, rows);
|
||||
}
|
||||
}
|
||||
|
||||
#define VAL(buf, elem) (data ## buf[(elem)])
|
||||
#define MUL_SPECTRUMS_ROW(A, B, C) \
|
||||
for (size_t j = j0; j < j1; j += 2) \
|
||||
{ \
|
||||
double a_re = VAL(A, j), a_im = VAL(A, j + 1); \
|
||||
double b_re = VAL(B, j), b_im = VAL(B, j + 1); \
|
||||
if (conjB) b_im = -b_im; \
|
||||
double c_re = a_re * b_re - a_im * b_im; \
|
||||
double c_im = a_re * b_im + a_im * b_re; \
|
||||
VAL(C, j) = (T)c_re; VAL(C, j + 1) = (T)c_im; \
|
||||
}
|
||||
template <typename T, bool conjB> static inline
|
||||
void mulSpectrums_processRow_noinplace(const T* dataA, const T* dataB, T* dataC, size_t j0, size_t j1)
|
||||
{
|
||||
MUL_SPECTRUMS_ROW(A, B, C);
|
||||
}
|
||||
template <typename T, bool conjB> static inline
|
||||
void mulSpectrums_processRow_inplaceA(const T* dataB, T* dataAC, size_t j0, size_t j1)
|
||||
{
|
||||
MUL_SPECTRUMS_ROW(AC, B, AC);
|
||||
}
|
||||
template <typename T, bool conjB, bool inplaceA> static inline
|
||||
void mulSpectrums_processRow(const T* dataA, const T* dataB, T* dataC, size_t j0, size_t j1)
|
||||
{
|
||||
if (inplaceA)
|
||||
mulSpectrums_processRow_inplaceA<T, conjB>(dataB, dataC, j0, j1);
|
||||
else
|
||||
mulSpectrums_processRow_noinplace<T, conjB>(dataA, dataB, dataC, j0, j1);
|
||||
}
|
||||
#undef MUL_SPECTRUMS_ROW
|
||||
#undef VAL
|
||||
|
||||
template <typename T, bool conjB, bool inplaceA> static inline
|
||||
void mulSpectrums_processRows(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows, size_t cols, size_t j0, size_t j1, bool is_1d_CN1)
|
||||
{
|
||||
while (rows-- > 0)
|
||||
{
|
||||
if (is_1d_CN1)
|
||||
dataC[0] = dataA[0]*dataB[0];
|
||||
mulSpectrums_processRow<T, conjB, inplaceA>(dataA, dataB, dataC, j0, j1);
|
||||
if (is_1d_CN1 && (cols & 1) == 0)
|
||||
dataC[j1] = dataA[j1]*dataB[j1];
|
||||
|
||||
dataA = (const T*)(((char*)dataA) + stepA);
|
||||
dataB = (const T*)(((char*)dataB) + stepB);
|
||||
dataC = (T*)(((char*)dataC) + stepC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T, bool conjB, bool inplaceA> static inline
|
||||
void mulSpectrums_Impl_(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows, size_t cols, size_t j0, size_t j1, bool is_1d, bool isCN1)
|
||||
{
|
||||
if (!is_1d && isCN1)
|
||||
{
|
||||
mulSpectrums_processCols<T, conjB, inplaceA>(dataA, dataB, dataC, stepA, stepB, stepC, rows, cols);
|
||||
}
|
||||
mulSpectrums_processRows<T, conjB, inplaceA>(dataA, dataB, dataC, stepA, stepB, stepC, rows, cols, j0, j1, is_1d && isCN1);
|
||||
}
|
||||
template <typename T, bool conjB> static inline
|
||||
void mulSpectrums_Impl(const T* dataA, const T* dataB, T* dataC, size_t stepA, size_t stepB, size_t stepC, size_t rows, size_t cols, size_t j0, size_t j1, bool is_1d, bool isCN1)
|
||||
{
|
||||
if (dataA == dataC)
|
||||
mulSpectrums_Impl_<T, conjB, true>(dataA, dataB, dataC, stepA, stepB, stepC, rows, cols, j0, j1, is_1d, isCN1);
|
||||
else
|
||||
mulSpectrums_Impl_<T, conjB, false>(dataA, dataB, dataC, stepA, stepB, stepC, rows, cols, j0, j1, is_1d, isCN1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
|
||||
OutputArray _dst, int flags, bool conjB )
|
||||
{
|
||||
Mat srcA = _srcA.getMat(), srcB = _srcB.getMat();
|
||||
int depth = srcA.depth(), cn = srcA.channels(), type = srcA.type();
|
||||
int rows = srcA.rows, cols = srcA.cols;
|
||||
int j, k;
|
||||
size_t rows = srcA.rows, cols = srcA.cols;
|
||||
|
||||
CV_Assert( type == srcB.type() && srcA.size() == srcB.size() );
|
||||
CV_Assert( type == CV_32FC1 || type == CV_32FC2 || type == CV_64FC1 || type == CV_64FC2 );
|
||||
@@ -1905,149 +2023,42 @@ void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
|
||||
_dst.create( srcA.rows, srcA.cols, type );
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
bool is_1d = (flags & DFT_ROWS) || (rows == 1 || (cols == 1 &&
|
||||
srcA.isContinuous() && srcB.isContinuous() && dst.isContinuous()));
|
||||
// correct inplace support
|
||||
// Case 'dst.data == srcA.data' is handled by implementation,
|
||||
// because it is used frequently (filter2D, matchTemplate)
|
||||
if (dst.data == srcB.data)
|
||||
srcB = srcB.clone(); // workaround for B only
|
||||
|
||||
bool is_1d = (flags & DFT_ROWS)
|
||||
|| (rows == 1)
|
||||
|| (cols == 1 && srcA.isContinuous() && srcB.isContinuous() && dst.isContinuous());
|
||||
|
||||
if( is_1d && !(flags & DFT_ROWS) )
|
||||
cols = cols + rows - 1, rows = 1;
|
||||
|
||||
int ncols = cols*cn;
|
||||
int j0 = cn == 1;
|
||||
int j1 = ncols - (cols % 2 == 0 && cn == 1);
|
||||
bool isCN1 = cn == 1;
|
||||
size_t j0 = isCN1 ? 1 : 0;
|
||||
size_t j1 = cols*cn - (((cols & 1) == 0 && cn == 1) ? 1 : 0);
|
||||
|
||||
if( depth == CV_32F )
|
||||
if (depth == CV_32F)
|
||||
{
|
||||
const float* dataA = (const float*)srcA.data;
|
||||
const float* dataB = (const float*)srcB.data;
|
||||
float* dataC = (float*)dst.data;
|
||||
|
||||
size_t stepA = srcA.step/sizeof(dataA[0]);
|
||||
size_t stepB = srcB.step/sizeof(dataB[0]);
|
||||
size_t stepC = dst.step/sizeof(dataC[0]);
|
||||
|
||||
if( !is_1d && cn == 1 )
|
||||
{
|
||||
for( k = 0; k < (cols % 2 ? 1 : 2); k++ )
|
||||
{
|
||||
if( k == 1 )
|
||||
dataA += cols - 1, dataB += cols - 1, dataC += cols - 1;
|
||||
dataC[0] = dataA[0]*dataB[0];
|
||||
if( rows % 2 == 0 )
|
||||
dataC[(rows-1)*stepC] = dataA[(rows-1)*stepA]*dataB[(rows-1)*stepB];
|
||||
if( !conjB )
|
||||
for( j = 1; j <= rows - 2; j += 2 )
|
||||
{
|
||||
double re = (double)dataA[j*stepA]*dataB[j*stepB] -
|
||||
(double)dataA[(j+1)*stepA]*dataB[(j+1)*stepB];
|
||||
double im = (double)dataA[j*stepA]*dataB[(j+1)*stepB] +
|
||||
(double)dataA[(j+1)*stepA]*dataB[j*stepB];
|
||||
dataC[j*stepC] = (float)re; dataC[(j+1)*stepC] = (float)im;
|
||||
}
|
||||
else
|
||||
for( j = 1; j <= rows - 2; j += 2 )
|
||||
{
|
||||
double re = (double)dataA[j*stepA]*dataB[j*stepB] +
|
||||
(double)dataA[(j+1)*stepA]*dataB[(j+1)*stepB];
|
||||
double im = (double)dataA[(j+1)*stepA]*dataB[j*stepB] -
|
||||
(double)dataA[j*stepA]*dataB[(j+1)*stepB];
|
||||
dataC[j*stepC] = (float)re; dataC[(j+1)*stepC] = (float)im;
|
||||
}
|
||||
if( k == 1 )
|
||||
dataA -= cols - 1, dataB -= cols - 1, dataC -= cols - 1;
|
||||
}
|
||||
}
|
||||
|
||||
for( ; rows--; dataA += stepA, dataB += stepB, dataC += stepC )
|
||||
{
|
||||
if( is_1d && cn == 1 )
|
||||
{
|
||||
dataC[0] = dataA[0]*dataB[0];
|
||||
if( cols % 2 == 0 )
|
||||
dataC[j1] = dataA[j1]*dataB[j1];
|
||||
}
|
||||
|
||||
if( !conjB )
|
||||
for( j = j0; j < j1; j += 2 )
|
||||
{
|
||||
double re = (double)dataA[j]*dataB[j] - (double)dataA[j+1]*dataB[j+1];
|
||||
double im = (double)dataA[j+1]*dataB[j] + (double)dataA[j]*dataB[j+1];
|
||||
dataC[j] = (float)re; dataC[j+1] = (float)im;
|
||||
}
|
||||
else
|
||||
for( j = j0; j < j1; j += 2 )
|
||||
{
|
||||
double re = (double)dataA[j]*dataB[j] + (double)dataA[j+1]*dataB[j+1];
|
||||
double im = (double)dataA[j+1]*dataB[j] - (double)dataA[j]*dataB[j+1];
|
||||
dataC[j] = (float)re; dataC[j+1] = (float)im;
|
||||
}
|
||||
}
|
||||
if (!conjB)
|
||||
mulSpectrums_Impl<float, false>(dataA, dataB, dataC, srcA.step, srcB.step, dst.step, rows, cols, j0, j1, is_1d, isCN1);
|
||||
else
|
||||
mulSpectrums_Impl<float, true>(dataA, dataB, dataC, srcA.step, srcB.step, dst.step, rows, cols, j0, j1, is_1d, isCN1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* dataA = (const double*)srcA.data;
|
||||
const double* dataB = (const double*)srcB.data;
|
||||
double* dataC = (double*)dst.data;
|
||||
|
||||
size_t stepA = srcA.step/sizeof(dataA[0]);
|
||||
size_t stepB = srcB.step/sizeof(dataB[0]);
|
||||
size_t stepC = dst.step/sizeof(dataC[0]);
|
||||
|
||||
if( !is_1d && cn == 1 )
|
||||
{
|
||||
for( k = 0; k < (cols % 2 ? 1 : 2); k++ )
|
||||
{
|
||||
if( k == 1 )
|
||||
dataA += cols - 1, dataB += cols - 1, dataC += cols - 1;
|
||||
dataC[0] = dataA[0]*dataB[0];
|
||||
if( rows % 2 == 0 )
|
||||
dataC[(rows-1)*stepC] = dataA[(rows-1)*stepA]*dataB[(rows-1)*stepB];
|
||||
if( !conjB )
|
||||
for( j = 1; j <= rows - 2; j += 2 )
|
||||
{
|
||||
double re = dataA[j*stepA]*dataB[j*stepB] -
|
||||
dataA[(j+1)*stepA]*dataB[(j+1)*stepB];
|
||||
double im = dataA[j*stepA]*dataB[(j+1)*stepB] +
|
||||
dataA[(j+1)*stepA]*dataB[j*stepB];
|
||||
dataC[j*stepC] = re; dataC[(j+1)*stepC] = im;
|
||||
}
|
||||
else
|
||||
for( j = 1; j <= rows - 2; j += 2 )
|
||||
{
|
||||
double re = dataA[j*stepA]*dataB[j*stepB] +
|
||||
dataA[(j+1)*stepA]*dataB[(j+1)*stepB];
|
||||
double im = dataA[(j+1)*stepA]*dataB[j*stepB] -
|
||||
dataA[j*stepA]*dataB[(j+1)*stepB];
|
||||
dataC[j*stepC] = re; dataC[(j+1)*stepC] = im;
|
||||
}
|
||||
if( k == 1 )
|
||||
dataA -= cols - 1, dataB -= cols - 1, dataC -= cols - 1;
|
||||
}
|
||||
}
|
||||
|
||||
for( ; rows--; dataA += stepA, dataB += stepB, dataC += stepC )
|
||||
{
|
||||
if( is_1d && cn == 1 )
|
||||
{
|
||||
dataC[0] = dataA[0]*dataB[0];
|
||||
if( cols % 2 == 0 )
|
||||
dataC[j1] = dataA[j1]*dataB[j1];
|
||||
}
|
||||
|
||||
if( !conjB )
|
||||
for( j = j0; j < j1; j += 2 )
|
||||
{
|
||||
double re = dataA[j]*dataB[j] - dataA[j+1]*dataB[j+1];
|
||||
double im = dataA[j+1]*dataB[j] + dataA[j]*dataB[j+1];
|
||||
dataC[j] = re; dataC[j+1] = im;
|
||||
}
|
||||
else
|
||||
for( j = j0; j < j1; j += 2 )
|
||||
{
|
||||
double re = dataA[j]*dataB[j] + dataA[j+1]*dataB[j+1];
|
||||
double im = dataA[j+1]*dataB[j] - dataA[j]*dataB[j+1];
|
||||
dataC[j] = re; dataC[j+1] = im;
|
||||
}
|
||||
}
|
||||
if (!conjB)
|
||||
mulSpectrums_Impl<double, false>(dataA, dataB, dataC, srcA.step, srcB.step, dst.step, rows, cols, j0, j1, is_1d, isCN1);
|
||||
else
|
||||
mulSpectrums_Impl<double, true>(dataA, dataB, dataC, srcA.step, srcB.step, dst.step, rows, cols, j0, j1, is_1d, isCN1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
|
||||
|
||||
size_t esz = elemSize();
|
||||
|
||||
void* devPtr;
|
||||
void* devPtr = NULL;
|
||||
gpuFuncTable()->mallocPitch(&devPtr, &step, esz * cols, rows);
|
||||
|
||||
// Single row must be continuous
|
||||
|
||||
+32
-12
@@ -279,21 +279,31 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange) : size(&r
|
||||
}
|
||||
|
||||
*this = m;
|
||||
if( _rowRange != Range::all() && _rowRange != Range(0,rows) )
|
||||
try
|
||||
{
|
||||
CV_Assert( 0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows );
|
||||
rows = _rowRange.size();
|
||||
data += step*_rowRange.start;
|
||||
flags |= SUBMATRIX_FLAG;
|
||||
}
|
||||
if( _rowRange != Range::all() && _rowRange != Range(0,rows) )
|
||||
{
|
||||
CV_Assert( 0 <= _rowRange.start && _rowRange.start <= _rowRange.end
|
||||
&& _rowRange.end <= m.rows );
|
||||
rows = _rowRange.size();
|
||||
data += step*_rowRange.start;
|
||||
flags |= SUBMATRIX_FLAG;
|
||||
}
|
||||
|
||||
if( _colRange != Range::all() && _colRange != Range(0,cols) )
|
||||
if( _colRange != Range::all() && _colRange != Range(0,cols) )
|
||||
{
|
||||
CV_Assert( 0 <= _colRange.start && _colRange.start <= _colRange.end
|
||||
&& _colRange.end <= m.cols );
|
||||
cols = _colRange.size();
|
||||
data += _colRange.start*elemSize();
|
||||
flags &= cols < m.cols ? ~CONTINUOUS_FLAG : -1;
|
||||
flags |= SUBMATRIX_FLAG;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
CV_Assert( 0 <= _colRange.start && _colRange.start <= _colRange.end && _colRange.end <= m.cols );
|
||||
cols = _colRange.size();
|
||||
data += _colRange.start*elemSize();
|
||||
flags &= cols < m.cols ? ~CONTINUOUS_FLAG : -1;
|
||||
flags |= SUBMATRIX_FLAG;
|
||||
release();
|
||||
throw;
|
||||
}
|
||||
|
||||
if( rows == 1 )
|
||||
@@ -4277,6 +4287,16 @@ Rect RotatedRect::boundingRect() const
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Rect_<float> RotatedRect::boundingRect2f() const
|
||||
{
|
||||
Point2f pt[4];
|
||||
points(pt);
|
||||
Rect_<float> r(Point_<float>(min(min(min(pt[0].x, pt[1].x), pt[2].x), pt[3].x), min(min(min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
Point_<float>(max(max(max(pt[0].x, pt[1].x), pt[2].x), pt[3].x), max(max(max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <sys/types.h>
|
||||
#if defined ANDROID
|
||||
#include <sys/sysconf.h>
|
||||
#else
|
||||
#elif defined __APPLE__
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -163,8 +163,6 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
|
||||
#include <sys/types.h>
|
||||
#if defined ANDROID
|
||||
#include <sys/sysconf.h>
|
||||
#else
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -908,6 +906,11 @@ int _interlockedExchangeAdd(int* addr, int delta)
|
||||
|
||||
#elif defined __APPLE__
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
struct Mutex::Impl
|
||||
@@ -923,6 +926,10 @@ struct Mutex::Impl
|
||||
int refcount;
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#elif defined __linux__ && !defined ANDROID && !defined __LINUXTHREADS_OLD__
|
||||
|
||||
struct Mutex::Impl
|
||||
|
||||
@@ -52,9 +52,6 @@ using namespace std;
|
||||
|
||||
#define sign(a) a > 0 ? 1 : a == 0 ? 0 : -1
|
||||
|
||||
const int FLOAT_TYPE [2] = {CV_32F, CV_64F};
|
||||
const int INT_TYPE [5] = {CV_8U, CV_8S, CV_16U, CV_16S, CV_32S};
|
||||
|
||||
#define MAX_WIDTH 100
|
||||
#define MAX_HEIGHT 100
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static void cvTsSimpleSeqShiftAndCopy( CvTsSimpleSeq* seq, int from_idx, int to_
|
||||
(seq->count - from_idx)*elem_size );
|
||||
}
|
||||
seq->count += to_idx - from_idx;
|
||||
if( elem && to_idx > from_idx )
|
||||
if( elem )
|
||||
memcpy( seq->array + from_idx*elem_size, elem, (to_idx - from_idx)*elem_size );
|
||||
}
|
||||
|
||||
|
||||
@@ -419,9 +419,6 @@ static void fixCCS( Mat& mat, int cols, int flags )
|
||||
}
|
||||
}
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
{
|
||||
dst.create(src1.rows, src1.cols, src1.type());
|
||||
@@ -430,12 +427,27 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
CV_Assert( src1.size == src2.size && src1.type() == src2.type() &&
|
||||
(src1.type() == CV_32FC2 || src1.type() == CV_64FC2) );
|
||||
|
||||
const Mat* src1_ = &src1;
|
||||
Mat src1_tmp;
|
||||
if (dst.data == src1.data)
|
||||
{
|
||||
src1_tmp = src1.clone();
|
||||
src1_ = &src1_tmp;
|
||||
}
|
||||
const Mat* src2_ = &src2;
|
||||
Mat src2_tmp;
|
||||
if (dst.data == src2.data)
|
||||
{
|
||||
src2_tmp = src2.clone();
|
||||
src2_ = &src2_tmp;
|
||||
}
|
||||
|
||||
for( i = 0; i < dst.rows; i++ )
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
const float* a = src1.ptr<float>(i);
|
||||
const float* b = src2.ptr<float>(i);
|
||||
const float* a = src1_->ptr<float>(i);
|
||||
const float* b = src2_->ptr<float>(i);
|
||||
float* c = dst.ptr<float>(i);
|
||||
|
||||
if( !(flags & CV_DXT_MUL_CONJ) )
|
||||
@@ -459,8 +471,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* a = src1.ptr<double>(i);
|
||||
const double* b = src2.ptr<double>(i);
|
||||
const double* a = src1_->ptr<double>(i);
|
||||
const double* b = src2_->ptr<double>(i);
|
||||
double* c = dst.ptr<double>(i);
|
||||
|
||||
if( !(flags & CV_DXT_MUL_CONJ) )
|
||||
@@ -484,9 +496,6 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -778,6 +787,7 @@ public:
|
||||
protected:
|
||||
void run_func();
|
||||
void prepare_to_validation( int test_case_idx );
|
||||
double get_success_error_level( int test_case_idx, int i, int j );
|
||||
};
|
||||
|
||||
|
||||
@@ -785,6 +795,19 @@ CxCore_MulSpectrumsTest::CxCore_MulSpectrumsTest() : CxCore_DXTBaseTest( true, t
|
||||
{
|
||||
}
|
||||
|
||||
double CxCore_MulSpectrumsTest::get_success_error_level( int test_case_idx, int i, int j )
|
||||
{
|
||||
(void)test_case_idx;
|
||||
CV_Assert(i == OUTPUT);
|
||||
CV_Assert(j == 0);
|
||||
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
|
||||
CV_Assert(elem_depth == CV_32F || elem_depth == CV_64F);
|
||||
|
||||
element_wise_relative_error = false;
|
||||
double maxInputValue = 1000; // ArrayTest::get_minmax_bounds
|
||||
double err = 8 * maxInputValue; // result = A*B + C*D
|
||||
return (elem_depth == CV_32F ? FLT_EPSILON : DBL_EPSILON) * err;
|
||||
}
|
||||
|
||||
void CxCore_MulSpectrumsTest::run_func()
|
||||
{
|
||||
|
||||
@@ -736,7 +736,9 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
//ROI handling
|
||||
const int HARRIS_BLOCK_SIZE = 9;
|
||||
int halfPatchSize = patchSize / 2;
|
||||
int border = std::max(edgeThreshold, std::max(halfPatchSize, HARRIS_BLOCK_SIZE/2))+1;
|
||||
// sqrt(2.0) is for handling patch rotation
|
||||
int descPatchSize = cvCeil(halfPatchSize*sqrt(2.0));
|
||||
int border = std::max(edgeThreshold, std::max(descPatchSize, HARRIS_BLOCK_SIZE/2))+1;
|
||||
|
||||
Mat image = _image.getMat(), mask = _mask.getMat();
|
||||
if( image.type() != CV_8UC1 )
|
||||
|
||||
@@ -80,7 +80,7 @@ struct big_any_policy : typed_base_any_policy<T>
|
||||
{
|
||||
virtual void static_delete(void** x)
|
||||
{
|
||||
if (* x) delete (* reinterpret_cast<T**>(x)); *x = NULL;
|
||||
if (* x) { delete (* reinterpret_cast<T**>(x)); *x = NULL; }
|
||||
}
|
||||
virtual void copy_from_value(void const* src, void** dest)
|
||||
{
|
||||
|
||||
@@ -225,43 +225,49 @@ int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& di
|
||||
* @deprecated Use GenericIndex class instead
|
||||
*/
|
||||
template <typename T>
|
||||
class
|
||||
#ifndef _MSC_VER
|
||||
FLANN_DEPRECATED
|
||||
#endif
|
||||
Index_ {
|
||||
class Index_ {
|
||||
public:
|
||||
typedef typename L2<T>::ElementType ElementType;
|
||||
typedef typename L2<T>::ResultType DistanceType;
|
||||
|
||||
FLANN_DEPRECATED
|
||||
Index_(const Mat& features, const ::cvflann::IndexParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
~Index_();
|
||||
|
||||
FLANN_DEPRECATED
|
||||
void knnSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
|
||||
FLANN_DEPRECATED
|
||||
void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int radiusSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
|
||||
FLANN_DEPRECATED
|
||||
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
void save(std::string filename)
|
||||
{
|
||||
if (nnIndex_L1) nnIndex_L1->save(filename);
|
||||
if (nnIndex_L2) nnIndex_L2->save(filename);
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int veclen() const
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->veclen();
|
||||
if (nnIndex_L2) return nnIndex_L2->veclen();
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int size() const
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->size();
|
||||
if (nnIndex_L2) return nnIndex_L2->size();
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
::cvflann::IndexParams getParameters()
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->getParameters();
|
||||
@@ -269,7 +275,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters()
|
||||
FLANN_DEPRECATED
|
||||
const ::cvflann::IndexParams* getIndexParameters()
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->getIndexParameters();
|
||||
if (nnIndex_L2) return nnIndex_L2->getIndexParameters();
|
||||
@@ -281,10 +288,6 @@ private:
|
||||
::cvflann::Index< L1<ElementType> >* nnIndex_L1;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template <typename T>
|
||||
class FLANN_DEPRECATED Index_;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
Index_<T>::Index_(const Mat& dataset, const ::cvflann::IndexParams& params)
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
*/
|
||||
LshTable()
|
||||
{
|
||||
feature_size_ = 0;
|
||||
}
|
||||
|
||||
/** Default constructor
|
||||
@@ -156,7 +157,7 @@ public:
|
||||
*/
|
||||
LshTable(unsigned int feature_size, unsigned int key_size, std::vector<size_t> & indices)
|
||||
{
|
||||
(void)feature_size;
|
||||
feature_size_ = feature_size;
|
||||
(void)key_size;
|
||||
(void)indices;
|
||||
std::cerr << "LSH is not implemented for that type" << std::endl;
|
||||
@@ -335,6 +336,8 @@ private:
|
||||
*/
|
||||
unsigned int key_size_;
|
||||
|
||||
unsigned int feature_size_;
|
||||
|
||||
// Members only used for the unsigned char specialization
|
||||
/** The mask to apply to a feature to get the hash key
|
||||
* Only used in the unsigned char case
|
||||
@@ -350,9 +353,10 @@ inline LshTable<unsigned char>::LshTable( unsigned int feature_size,
|
||||
unsigned int subsignature_size,
|
||||
std::vector<size_t> & indices )
|
||||
{
|
||||
feature_size_ = feature_size;
|
||||
initialize(subsignature_size);
|
||||
// Allocate the mask
|
||||
mask_ = std::vector<size_t>((size_t)ceil((float)(feature_size * sizeof(char)) / (float)sizeof(size_t)), 0);
|
||||
mask_ = std::vector<size_t>((feature_size * sizeof(char) + sizeof(size_t) - 1) / sizeof(size_t), 0);
|
||||
|
||||
// Generate a random set of order of subsignature_size_ bits
|
||||
for (unsigned int i = 0; i < key_size_; ++i) {
|
||||
@@ -391,6 +395,7 @@ inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) cons
|
||||
{
|
||||
// no need to check if T is dividable by sizeof(size_t) like in the Hamming
|
||||
// distance computation as we have a mask
|
||||
// FIXIT: This is bad assumption, because we reading tail bytes after of the allocated features buffer
|
||||
const size_t* feature_block_ptr = reinterpret_cast<const size_t*> ((const void*)feature);
|
||||
|
||||
// Figure out the subsignature of the feature
|
||||
@@ -399,10 +404,20 @@ inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) cons
|
||||
size_t subsignature = 0;
|
||||
size_t bit_index = 1;
|
||||
|
||||
for (std::vector<size_t>::const_iterator pmask_block = mask_.begin(); pmask_block != mask_.end(); ++pmask_block) {
|
||||
for (unsigned i = 0; i < feature_size_; i += sizeof(size_t)) {
|
||||
// get the mask and signature blocks
|
||||
size_t feature_block = *feature_block_ptr;
|
||||
size_t mask_block = *pmask_block;
|
||||
size_t feature_block;
|
||||
if (i <= feature_size_ - sizeof(size_t))
|
||||
{
|
||||
feature_block = *feature_block_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t tmp = 0;
|
||||
memcpy(&tmp, feature_block_ptr, feature_size_ - i); // preserve bytes order
|
||||
feature_block = tmp;
|
||||
}
|
||||
size_t mask_block = mask_[i / sizeof(size_t)];
|
||||
while (mask_block) {
|
||||
// Get the lowest set bit in the mask block
|
||||
size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block);
|
||||
|
||||
@@ -22,6 +22,8 @@ source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})
|
||||
source_group("Device" FILES ${lib_device_hdrs})
|
||||
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-private-field)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp" "src/nvidia/*.h*")
|
||||
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
|
||||
@@ -29,7 +31,7 @@ if(HAVE_CUDA)
|
||||
|
||||
source_group("Src\\NVidia" FILES ${ncv_files})
|
||||
ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter -Wstrict-aliasing /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
|
||||
@@ -186,9 +186,9 @@ Reduces a matrix to a vector.
|
||||
|
||||
:param mtx: Source 2D matrix.
|
||||
|
||||
:param vec: Destination vector. Its size and type is defined by ``dim`` and ``dtype`` parameters.
|
||||
:param vec: Destination row vector. Its type is defined by ``dtype`` parameter.
|
||||
|
||||
:param dim: Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
|
||||
:param dim: Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row(of length equal to number of matrix columns). 1 means that the matrix is reduced to a single column(of length equal to the number of matrix rows). In either case, the output is always stored as a row vector of appropriate length.
|
||||
|
||||
:param reduceOp: Reduction operation that could be one of the following:
|
||||
|
||||
@@ -202,6 +202,6 @@ Reduces a matrix to a vector.
|
||||
|
||||
:param dtype: When it is negative, the destination vector will have the same type as the source matrix. Otherwise, its type will be ``CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())`` .
|
||||
|
||||
The function ``reduce`` reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of ``CV_REDUCE_SUM`` and ``CV_REDUCE_AVG`` , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.
|
||||
The function ``reduce`` reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single column/row is obtained. However, the result is always stored as a row vector. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of ``CV_REDUCE_SUM`` and ``CV_REDUCE_AVG`` , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes.
|
||||
|
||||
.. seealso:: :ocv:func:`reduce`
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
|
||||
// std::auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 6
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
namespace cv { namespace gpu {
|
||||
|
||||
//////////////////////////////// CudaMem ////////////////////////////////
|
||||
@@ -429,13 +435,13 @@ CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& stre
|
||||
CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, Stream& stream = Stream::Null());
|
||||
|
||||
//! makes multi-channel array out of several single-channel arrays
|
||||
CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null());
|
||||
CV_EXPORTS void merge(const std::vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null());
|
||||
|
||||
//! copies each plane of a multi-channel array to a dedicated array
|
||||
CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, Stream& stream = Stream::Null());
|
||||
|
||||
//! copies each plane of a multi-channel array to a dedicated array
|
||||
CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null());
|
||||
CV_EXPORTS void split(const GpuMat& src, std::vector<GpuMat>& dst, Stream& stream = Stream::Null());
|
||||
|
||||
//! computes magnitude of complex (x(i).re, x(i).im) vector
|
||||
//! supports only CV_32FC2 type
|
||||
@@ -1262,9 +1268,9 @@ private:
|
||||
struct CV_EXPORTS HOGConfidence
|
||||
{
|
||||
double scale;
|
||||
vector<Point> locations;
|
||||
vector<double> confidences;
|
||||
vector<double> part_scores[4];
|
||||
std::vector<Point> locations;
|
||||
std::vector<double> confidences;
|
||||
std::vector<double> part_scores[4];
|
||||
};
|
||||
|
||||
struct CV_EXPORTS HOGDescriptor
|
||||
@@ -1282,27 +1288,27 @@ struct CV_EXPORTS HOGDescriptor
|
||||
size_t getDescriptorSize() const;
|
||||
size_t getBlockHistogramSize() const;
|
||||
|
||||
void setSVMDetector(const vector<float>& detector);
|
||||
void setSVMDetector(const std::vector<float>& detector);
|
||||
|
||||
static vector<float> getDefaultPeopleDetector();
|
||||
static vector<float> getPeopleDetector48x96();
|
||||
static vector<float> getPeopleDetector64x128();
|
||||
static std::vector<float> getDefaultPeopleDetector();
|
||||
static std::vector<float> getPeopleDetector48x96();
|
||||
static std::vector<float> getPeopleDetector64x128();
|
||||
|
||||
void detect(const GpuMat& img, vector<Point>& found_locations,
|
||||
void detect(const GpuMat& img, std::vector<Point>& found_locations,
|
||||
double hit_threshold=0, Size win_stride=Size(),
|
||||
Size padding=Size());
|
||||
|
||||
void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,
|
||||
void detectMultiScale(const GpuMat& img, std::vector<Rect>& found_locations,
|
||||
double hit_threshold=0, Size win_stride=Size(),
|
||||
Size padding=Size(), double scale0=1.05,
|
||||
int group_threshold=2);
|
||||
|
||||
void computeConfidence(const GpuMat& img, vector<Point>& hits, double hit_threshold,
|
||||
Size win_stride, Size padding, vector<Point>& locations, vector<double>& confidences);
|
||||
void computeConfidence(const GpuMat& img, std::vector<Point>& hits, double hit_threshold,
|
||||
Size win_stride, Size padding, std::vector<Point>& locations, std::vector<double>& confidences);
|
||||
|
||||
void computeConfidenceMultiScale(const GpuMat& img, vector<Rect>& found_locations,
|
||||
void computeConfidenceMultiScale(const GpuMat& img, std::vector<Rect>& found_locations,
|
||||
double hit_threshold, Size win_stride, Size padding,
|
||||
vector<HOGConfidence> &conf_out, int group_threshold);
|
||||
std::vector<HOGConfidence> &conf_out, int group_threshold);
|
||||
|
||||
void getDescriptors(const GpuMat& img, Size win_stride,
|
||||
GpuMat& descriptors,
|
||||
@@ -1832,11 +1838,11 @@ public:
|
||||
|
||||
private:
|
||||
GpuMat uPyr_[2];
|
||||
vector<GpuMat> prevPyr_;
|
||||
vector<GpuMat> nextPyr_;
|
||||
std::vector<GpuMat> prevPyr_;
|
||||
std::vector<GpuMat> nextPyr_;
|
||||
GpuMat vPyr_[2];
|
||||
vector<GpuMat> buf_;
|
||||
vector<GpuMat> unused;
|
||||
std::vector<GpuMat> buf_;
|
||||
std::vector<GpuMat> unused;
|
||||
bool isDeviceArch11_;
|
||||
};
|
||||
|
||||
@@ -2527,4 +2533,8 @@ CV_EXPORTS void calcWobbleSuppressionMaps(
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 6
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCV_GPU_HPP__ */
|
||||
|
||||
@@ -59,6 +59,11 @@
|
||||
#ifndef _ncvhaarobjectdetection_hpp_
|
||||
#define _ncvhaarobjectdetection_hpp_
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "NCV.hpp"
|
||||
|
||||
@@ -458,5 +463,8 @@ NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename,
|
||||
NCVVector<HaarFeature64> &h_HaarFeatures);
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // _ncvhaarobjectdetection_hpp_
|
||||
|
||||
@@ -215,8 +215,13 @@ if(HAVE_IMAGEIO AND IOS)
|
||||
endif()
|
||||
|
||||
if(HAVE_AVFOUNDATION)
|
||||
list(APPEND highgui_srcs src/cap_avfoundation.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
|
||||
if(IOS)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
|
||||
else()
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation_mac.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa" "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_QUICKTIME)
|
||||
@@ -236,7 +241,7 @@ endif(HAVE_INTELPERC)
|
||||
if(IOS)
|
||||
add_definitions(-DHAVE_IOS=1)
|
||||
list(APPEND highgui_srcs src/ios_conversions.mm src/cap_ios_abstract_camera.mm src/cap_ios_photo_camera.mm src/cap_ios_video_camera.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework AssetsLibrary")
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@@ -288,9 +293,6 @@ if(MSVC)
|
||||
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
|
||||
endif()
|
||||
|
||||
#stop automatic dependencies propagation for this module
|
||||
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations -Wno-clobbered)
|
||||
|
||||
|
||||
@@ -208,6 +208,8 @@ int RLByteStream::getByte()
|
||||
current = m_current;
|
||||
}
|
||||
|
||||
CV_Assert(current < m_end);
|
||||
|
||||
val = *((uchar*)current);
|
||||
m_current = current + 1;
|
||||
return val;
|
||||
|
||||
@@ -48,13 +48,20 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
RBS_THROW_EOS=-123, // <end of stream> exception code
|
||||
RBS_THROW_FORB=-124, // <forrbidden huffman code> exception code
|
||||
RBS_HUFF_FORB=2047, // forrbidden huffman code "value"
|
||||
RBS_BAD_HEADER=-125 // invalid header
|
||||
#define DECLARE_RBS_EXCEPTION(name) \
|
||||
class RBS_ ## name ## _Exception : public cv::Exception \
|
||||
{ \
|
||||
public: \
|
||||
RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
|
||||
cv::Exception(code_, err_, func_, file_, line_) \
|
||||
{} \
|
||||
};
|
||||
DECLARE_RBS_EXCEPTION(THROW_EOS)
|
||||
#define RBS_THROW_EOS RBS_THROW_EOS_Exception(CV_StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
|
||||
DECLARE_RBS_EXCEPTION(THROW_FORB)
|
||||
#define RBS_THROW_FORB RBS_THROW_FORB_Exception(CV_StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
|
||||
DECLARE_RBS_EXCEPTION(BAD_HEADER)
|
||||
#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(CV_StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
|
||||
|
||||
typedef unsigned long ulong;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -907,10 +907,10 @@ b = b > 255 ? 255 : b
|
||||
uyv2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels + (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y, u, v;
|
||||
register int r, g, b;
|
||||
int i = NumPixels + (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
v = src[i--] - 128;
|
||||
@@ -927,10 +927,10 @@ uyv2bgr(const unsigned char *src, unsigned char *dest,
|
||||
uyvy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y0, y1, u, v;
|
||||
register int r, g, b;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y0, y1, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
y1 = src[i--];
|
||||
@@ -953,10 +953,10 @@ uyvy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
uyyvyy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels + (NumPixels >> 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y0, y1, y2, y3, u, v;
|
||||
register int r, g, b;
|
||||
int i = NumPixels + (NumPixels >> 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y0, y1, y2, y3, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
y3 = src[i--];
|
||||
@@ -988,9 +988,9 @@ uyyvyy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
y2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = NumPixels - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
@@ -1004,9 +1004,9 @@ y2bgr(const unsigned char *src, unsigned char *dest,
|
||||
y162bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels, int bits)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
@@ -1022,9 +1022,9 @@ y162bgr(const unsigned char *src, unsigned char *dest,
|
||||
rgb482bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels, int bits)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#define HAVE_FFMPEG_SWSCALE
|
||||
#define HAVE_GENTOO_FFMPEG
|
||||
|
||||
#include "cap_ffmpeg_api.hpp"
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
@@ -126,9 +129,9 @@ extern "C" {
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
#if defined __APPLE__
|
||||
#include <sys/sysctl.h>
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
@@ -1482,6 +1485,10 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(52, 42, 0)
|
||||
st->avg_frame_rate = (AVRational){frame_rate, frame_rate_base};
|
||||
#endif
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user