mirror of
https://github.com/opencv/opencv.git
synced 2026-07-22 03:43:03 +04:00
Compare commits
232 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 82f8176b06 | |||
| a03b7575ba | |||
| 8bae39ce8a | |||
| aa89881321 | |||
| 30b01a2d29 | |||
| dc328451eb | |||
| a49600cb24 | |||
| 0157ff0bc3 | |||
| 7e71666a0b | |||
| 7b677bb017 | |||
| 9b954de175 | |||
| 7f3af2b2d9 | |||
| fd63c60418 | |||
| 1c34941537 | |||
| b0f0194595 | |||
| 8484c8af7c | |||
| 51cfa51924 | |||
| f1c5d8364f | |||
| 19f4c4403a | |||
| e89405d48f | |||
| eaf0b04530 | |||
| cbae431752 | |||
| 0239c195d8 | |||
| a32aec5ba6 | |||
| dd131219b2 | |||
| 2cf58febf8 | |||
| 99091a6246 | |||
| 0354d01e79 | |||
| 45d3aac730 | |||
| 318ac6b8c9 | |||
| 7d332100a4 | |||
| 56072c4406 | |||
| cd64b504b8 | |||
| 443059e371 | |||
| 8f9c4d23e0 | |||
| 8b90db3f25 | |||
| ec16307632 | |||
| fdefc4b09d | |||
| 61d8292652 | |||
| 43f1b72e92 | |||
| 1f4b8c2785 | |||
| 97eae6b546 | |||
| 572d6d795d | |||
| 7459388dd9 | |||
| 249edb2c99 | |||
| 00cc4aa230 | |||
| 7c0193bb75 | |||
| 97507e42a1 | |||
| 91fe01beca | |||
| 591a08721e | |||
| a28733148e | |||
| e10e628036 | |||
| 738b388a64 | |||
| 9802024f71 | |||
| 1659e96766 | |||
| c1dea8465e | |||
| 678d383f26 | |||
| e15a56d142 | |||
| c46521ad65 | |||
| d0f3468477 | |||
| 3224b0a75a | |||
| 7d8110772a | |||
| 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 |
+4
-3
@@ -1,9 +1,10 @@
|
||||
# ignore dot files/directories
|
||||
.*
|
||||
!.gitignore
|
||||
|
||||
*.autosave
|
||||
*.pyc
|
||||
*.user
|
||||
*~
|
||||
.*.swp
|
||||
.DS_Store
|
||||
.sw[a-z]
|
||||
tags
|
||||
tegra/
|
||||
|
||||
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
+3
-1
@@ -25,7 +25,7 @@ endif(WIN32 AND NOT MINGW)
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes
|
||||
-Wno-unused-but-set-parameter -Wmissing-declarations -Wunused -Wshadow -Wsign-compare)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wstrict-prototypes) # clang
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4018 /wd4101 /wd4244 /wd4267 /wd4715) # vs2005
|
||||
|
||||
if(UNIX)
|
||||
@@ -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
+4
-2
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if(ARM AND ENABLE_NEON AND NOT AARCH64)
|
||||
if(ARM AND ENABLE_NEON AND NOT AARCH64 AND NOT IOS)
|
||||
project(${PNG_LIBRARY} ASM)
|
||||
else()
|
||||
project(${PNG_LIBRARY})
|
||||
@@ -14,7 +14,7 @@ ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR})
|
||||
file(GLOB lib_srcs *.c)
|
||||
file(GLOB lib_hdrs *.h)
|
||||
|
||||
if(ARM AND ENABLE_NEON AND NOT AARCH64)
|
||||
if(ARM AND ENABLE_NEON AND NOT AARCH64 AND NOT IOS)
|
||||
list(APPEND lib_srcs arm/filter_neon.S arm/arm_init.c)
|
||||
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||
else()
|
||||
@@ -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}
|
||||
)
|
||||
|
||||
|
||||
+60
-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)
|
||||
@@ -685,6 +683,16 @@ endif()
|
||||
# ========================== build platform ==========================
|
||||
status("")
|
||||
status(" Platform:")
|
||||
if(NOT DEFINED OPENCV_TIMESTAMP
|
||||
AND NOT CMAKE_VERSION VERSION_LESS 2.8.11
|
||||
AND NOT BUILD_INFO_SKIP_TIMESTAMP
|
||||
)
|
||||
string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
|
||||
set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
|
||||
endif()
|
||||
if(OPENCV_TIMESTAMP)
|
||||
status(" Timestamp:" ${OPENCV_TIMESTAMP})
|
||||
endif()
|
||||
status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
|
||||
@@ -705,10 +713,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 +734,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 +884,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 +923,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 +1026,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 +1096,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()
|
||||
@@ -125,7 +164,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Other optimizations
|
||||
if(ENABLE_OMIT_FRAME_POINTER)
|
||||
add_extra_compiler_option(-fomit-frame-pointer)
|
||||
else()
|
||||
elseif(DEFINED ENABLE_OMIT_FRAME_POINTER)
|
||||
add_extra_compiler_option(-fno-omit-frame-pointer)
|
||||
endif()
|
||||
if(ENABLE_FAST_MATH)
|
||||
@@ -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()
|
||||
|
||||
@@ -61,7 +61,9 @@ if(NOT DEFINED OpenCV_CUDA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
|
||||
# custom overrided values
|
||||
elseif(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
set(OpenCV_TBB_ARCH intel64)
|
||||
@@ -81,6 +83,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION MATCHES "^191[0-9]$")
|
||||
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
|
||||
@@ -124,7 +82,9 @@ if(NOT DEFINED OpenCV_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
|
||||
# custom overrided values
|
||||
elseif(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
@@ -142,6 +102,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION MATCHES "^191[0-9]$")
|
||||
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()
|
||||
|
||||
+150
-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,15 @@ function(ocv_source_group group)
|
||||
source_group(${group} FILES ${srcs})
|
||||
endfunction()
|
||||
|
||||
macro(ocv_get_libname var_name)
|
||||
get_filename_component(__libname "${ARGN}" NAME)
|
||||
# libopencv_core.so.3.3 -> opencv_core
|
||||
string(REGEX REPLACE "^lib(.+)\\.(a|so)(\\.[.0-9]+)?$" "\\1" __libname "${__libname}")
|
||||
# MacOSX: libopencv_core.3.3.1.dylib -> opencv_core
|
||||
string(REGEX REPLACE "^lib(.+[^.0-9])\\.([.0-9]+\\.)?dylib$" "\\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)
|
||||
|
||||
@@ -440,5 +440,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title=" Camera calibration With OpenCV - Chessboard or asymmetrical circle pattern." width="560" height="349" src="http://www.youtube.com/embed/ViPN810E0SU?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title=" Camera calibration With OpenCV - Chessboard or asymmetrical circle pattern." width="560" height="349" src="https://www.youtube.com/embed/ViPN810E0SU?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -275,5 +275,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="File Input and Output using XML and YAML files in OpenCV" width="560" height="349" src="http://www.youtube.com/embed/A4yqVnByMMM?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="File Input and Output using XML and YAML files in OpenCV" width="560" height="349" src="https://www.youtube.com/embed/A4yqVnByMMM?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -179,5 +179,5 @@ Finally, you may watch a sample run of the program on the `video posted <https:/
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="How to scan images in OpenCV?" width="560" height="349" src="http://www.youtube.com/embed/fB3AN5fjgwc?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="How to scan images in OpenCV?" width="560" height="349" src="https://www.youtube.com/embed/fB3AN5fjgwc?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -125,5 +125,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Interoperability with OpenCV 1" width="560" height="349" src="http://www.youtube.com/embed/qckm-zvo31w?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Interoperability with OpenCV 1" width="560" height="349" src="https://www.youtube.com/embed/qckm-zvo31w?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -128,7 +128,7 @@ For example:
|
||||
|
||||
You can download this source code from :download:`here <../../../../samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp>` or look in the OpenCV source code libraries sample directory at :file:`samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp`.
|
||||
|
||||
Check out an instance of running the program on our `YouTube channel <http://www.youtube.com/watch?v=7PF1tAU9se4>`_ .
|
||||
Check out an instance of running the program on our `YouTube channel <https://www.youtube.com/watch?v=7PF1tAU9se4>`_ .
|
||||
|
||||
.. raw:: html
|
||||
|
||||
|
||||
@@ -307,5 +307,5 @@ You can also find a quick video demonstration of this on `YouTube <https://www.y
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Install OpenCV by using its source files - Part 1" width="560" height="349" src="http://www.youtube.com/embed/1tibU7vGWpk?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Install OpenCV by using its source files - Part 1" width="560" height="349" src="https://www.youtube.com/embed/1tibU7vGWpk?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -144,5 +144,5 @@ In both cases we managed a performance increase of almost 100% compared to the C
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Similarity check (PNSR and SSIM) on the GPU" width="560" height="349" src="http://www.youtube.com/embed/3_ESXmFlnvY?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Similarity check (PNSR and SSIM) on the GPU" width="560" height="349" src="https://www.youtube.com/embed/3_ESXmFlnvY?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -212,5 +212,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Video Input with OpenCV (Plus PSNR and MSSIM)" width="560" height="349" src="http://www.youtube.com/embed/iOcNljutOgg?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Video Input with OpenCV (Plus PSNR and MSSIM)" width="560" height="349" src="https://www.youtube.com/embed/iOcNljutOgg?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -132,5 +132,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="http://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="https://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -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 |
+1
-1
@@ -81,7 +81,7 @@ Gaussian Filter
|
||||
|
||||
G_{0}(x, y) = A e^{ \dfrac{ -(x - \mu_{x})^{2} }{ 2\sigma^{2}_{x} } + \dfrac{ -(y - \mu_{y})^{2} }{ 2\sigma^{2}_{y} } }
|
||||
|
||||
where :math:`\mu` is the mean (the peak) and :math:`\sigma` represents the variance (per each of the variables :math:`x` and :math:`y`)
|
||||
where :math:`\mu` is the mean (the peak) and :math:`\sigma` represents the standard deviation (per each of the variables :math:`x` and :math:`y`)
|
||||
|
||||
|
||||
Median Filter
|
||||
|
||||
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
|
||||
------------------------
|
||||
|
||||
@@ -129,5 +129,5 @@ Result
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Introduction - Display an Image" width="560" height="349" src="http://www.youtube.com/embed/1OJEqpuaGc4?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Introduction - Display an Image" width="560" height="349" src="https://www.youtube.com/embed/1OJEqpuaGc4?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -358,7 +358,7 @@ Now here's our recommendation for the structure of the tutorial (although, remem
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="http://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="https://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
This results in the text and video: You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=jpBwHxsl1_0>`_.
|
||||
@@ -366,7 +366,7 @@ Now here's our recommendation for the structure of the tutorial (although, remem
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="http://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Creating a video with OpenCV" width="560" height="349" src="https://www.youtube.com/embed/jpBwHxsl1_0?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
When these aren't self-explanatory make sure to throw in a few guiding lines about what and why we can see.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -40,8 +40,8 @@ You may find the content of this tutorial also inside the following videos: `Par
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Install OpenCV by using its source files - Part 1" width="560" height="349" src="http://www.youtube.com/embed/NnovZ1cTlMs?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Install OpenCV by using its source files - Part 2" width="560" height="349" src="http://www.youtube.com/embed/qGNWMcfWwPU?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Install OpenCV by using its source files - Part 1" width="560" height="349" src="https://www.youtube.com/embed/NnovZ1cTlMs?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Install OpenCV by using its source files - Part 2" width="560" height="349" src="https://www.youtube.com/embed/qGNWMcfWwPU?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
.. warning:: These videos above are long-obsolete and contain inaccurate information. Be careful, since solutions described in those videos are no longer supported and may even break your install.
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -120,10 +120,10 @@ After the processing we need to convert it back to UIImage.
|
||||
:alt: header
|
||||
:align: center
|
||||
|
||||
Check out an instance of running code with more Image Effects on `YouTube <http://www.youtube.com/watch?v=Ko3K_xdhJ1I>`_ .
|
||||
Check out an instance of running code with more Image Effects on `YouTube <https://www.youtube.com/watch?v=Ko3K_xdhJ1I>`_ .
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe width="560" height="350" src="http://www.youtube.com/embed/Ko3K_xdhJ1I" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe width="560" height="350" src="https://www.youtube.com/embed/Ko3K_xdhJ1I" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
@@ -215,5 +215,5 @@ You may observe a runtime instance of this on the `YouTube here <https://www.you
|
||||
.. raw:: html
|
||||
|
||||
<div align="center">
|
||||
<iframe title="Support Vector Machines for Non-Linearly Separable Data" width="560" height="349" src="http://www.youtube.com/embed/vFv2yPcSo-Q?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
<iframe title="Support Vector Machines for Non-Linearly Separable Data" width="560" height="349" src="https://www.youtube.com/embed/vFv2yPcSo-Q?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
#include <android/log.h>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <opencv2/core/version.hpp>
|
||||
#include "camera_activity.hpp"
|
||||
#include "camera_wrapper.h"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -864,10 +864,10 @@ Rect getValidDisparityROI( Rect roi1, Rect roi2,
|
||||
int SADWindowSize )
|
||||
{
|
||||
int SW2 = SADWindowSize/2;
|
||||
int minD = minDisparity, maxD = minDisparity + numberOfDisparities - 1;
|
||||
int maxD = minDisparity + numberOfDisparities - 1;
|
||||
|
||||
int xmin = max(roi1.x, roi2.x + maxD) + SW2;
|
||||
int xmax = min(roi1.x + roi1.width, roi2.x + roi2.width - minD) - SW2;
|
||||
int xmax = min(roi1.x + roi1.width, roi2.x + roi2.width) - SW2;
|
||||
int ymin = max(roi1.y, roi2.y) + SW2;
|
||||
int ymax = min(roi1.y + roi1.height, roi2.y + roi2.height) - SW2;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
|
||||
protected:
|
||||
std::string combine(const std::string& _item1, const std::string& _item2);
|
||||
cv::Mat mergeRectification(const cv::Mat& l, const cv::Mat& r);
|
||||
static void merge4(const cv::Mat& tl, const cv::Mat& tr, const cv::Mat& bl, const cv::Mat& br, cv::Mat& merged);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -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;
|
||||
|
||||
@@ -385,11 +385,7 @@ TEST_F(fisheyeTest, EtimateUncertainties)
|
||||
CV_Assert(errors.alpha == 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
TEST_F(fisheyeTest, DISABLED_rectify)
|
||||
#else
|
||||
TEST_F(fisheyeTest, rectify)
|
||||
#endif
|
||||
TEST_F(fisheyeTest, stereoRectify)
|
||||
{
|
||||
const std::string folder =combine(datasets_repository_path, "calib-3_stereo_from_JY");
|
||||
|
||||
@@ -405,20 +401,65 @@ TEST_F(fisheyeTest, rectify)
|
||||
cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, theR, theT, R1, R2, P1, P2, Q,
|
||||
cv::CALIB_ZERO_DISPARITY, requested_size, balance, fov_scale);
|
||||
|
||||
// Collected with these CMake flags: -DWITH_IPP=OFF -DCMAKE_BUILD_TYPE=Debug
|
||||
cv::Matx33d R1_ref(
|
||||
0.9992853269091279, 0.03779164101000276, -0.0007920188690205426,
|
||||
-0.03778569762983931, 0.9992646472015868, 0.006511981857667881,
|
||||
0.001037534936357442, -0.006477400933964018, 0.9999784831677112
|
||||
);
|
||||
cv::Matx33d R2_ref(
|
||||
0.9994868963898833, -0.03197579751378937, -0.001868774538573449,
|
||||
0.03196298186616116, 0.9994677442608699, -0.0065265589947392,
|
||||
0.002076471801477729, 0.006463478587068991, 0.9999769555891836
|
||||
);
|
||||
cv::Matx34d P1_ref(
|
||||
420.8551870450913, 0, 586.501617798451, 0,
|
||||
0, 420.8551870450913, 374.7667511986098, 0,
|
||||
0, 0, 1, 0
|
||||
);
|
||||
cv::Matx34d P2_ref(
|
||||
420.8551870450913, 0, 586.501617798451, -41.77758076597302,
|
||||
0, 420.8551870450913, 374.7667511986098, 0,
|
||||
0, 0, 1, 0
|
||||
);
|
||||
cv::Matx44d Q_ref(
|
||||
1, 0, 0, -586.501617798451,
|
||||
0, 1, 0, -374.7667511986098,
|
||||
0, 0, 0, 420.8551870450913,
|
||||
0, 0, 10.07370889670733, -0
|
||||
);
|
||||
|
||||
const double eps = 1e-10;
|
||||
EXPECT_MAT_NEAR(R1_ref, R1, eps);
|
||||
EXPECT_MAT_NEAR(R2_ref, R2, eps);
|
||||
EXPECT_MAT_NEAR(P1_ref, P1, eps);
|
||||
EXPECT_MAT_NEAR(P2_ref, P2, eps);
|
||||
EXPECT_MAT_NEAR(Q_ref, Q, eps);
|
||||
|
||||
if (::testing::Test::HasFailure())
|
||||
{
|
||||
std::cout << "Actual values are:" << std::endl
|
||||
<< "R1 =" << std::endl << R1 << std::endl
|
||||
<< "R2 =" << std::endl << R2 << std::endl
|
||||
<< "P1 =" << std::endl << P1 << std::endl
|
||||
<< "P2 =" << std::endl << P2 << std::endl
|
||||
<< "Q =" << std::endl << Q << std::endl;
|
||||
}
|
||||
|
||||
#if 1 // Debug code
|
||||
cv::Mat lmapx, lmapy, rmapx, rmapy;
|
||||
//rewrite for fisheye
|
||||
cv::fisheye::initUndistortRectifyMap(K1, D1, R1, P1, requested_size, CV_32F, lmapx, lmapy);
|
||||
cv::fisheye::initUndistortRectifyMap(K2, D2, R2, P2, requested_size, CV_32F, rmapx, rmapy);
|
||||
|
||||
cv::Mat l, r, lundist, rundist;
|
||||
cv::VideoCapture lcap(combine(folder, "left/stereo_pair_%03d.jpg")),
|
||||
rcap(combine(folder, "right/stereo_pair_%03d.jpg"));
|
||||
|
||||
for(int i = 0;; ++i)
|
||||
for (int i = 0; i < 34; ++i)
|
||||
{
|
||||
lcap >> l; rcap >> r;
|
||||
if (l.empty() || r.empty())
|
||||
break;
|
||||
SCOPED_TRACE(cv::format("image %d", i));
|
||||
l = imread(combine(folder, cv::format("left/stereo_pair_%03d.jpg", i)), cv::IMREAD_COLOR);
|
||||
r = imread(combine(folder, cv::format("right/stereo_pair_%03d.jpg", i)), cv::IMREAD_COLOR);
|
||||
ASSERT_FALSE(l.empty());
|
||||
ASSERT_FALSE(r.empty());
|
||||
|
||||
int ndisp = 128;
|
||||
cv::rectangle(l, cv::Rect(255, 0, 829, l.rows-1), CV_RGB(255, 0, 0));
|
||||
@@ -427,15 +468,18 @@ TEST_F(fisheyeTest, rectify)
|
||||
cv::remap(l, lundist, lmapx, lmapy, cv::INTER_LINEAR);
|
||||
cv::remap(r, rundist, rmapx, rmapy, cv::INTER_LINEAR);
|
||||
|
||||
cv::Mat rectification = mergeRectification(lundist, rundist);
|
||||
for (int ii = 0; ii < lundist.rows; ii += 20)
|
||||
{
|
||||
cv::line(lundist, cv::Point(0, ii), cv::Point(lundist.cols, ii), cv::Scalar(0, 255, 0));
|
||||
cv::line(rundist, cv::Point(0, ii), cv::Point(lundist.cols, ii), cv::Scalar(0, 255, 0));
|
||||
}
|
||||
|
||||
cv::Mat correct = cv::imread(combine(datasets_repository_path, cv::format("rectification_AB_%03d.png", i)));
|
||||
cv::Mat rectification;
|
||||
merge4(l, r, lundist, rundist, rectification);
|
||||
|
||||
if (correct.empty())
|
||||
cv::imwrite(combine(datasets_repository_path, cv::format("rectification_AB_%03d.png", i)), rectification);
|
||||
else
|
||||
EXPECT_MAT_NEAR(correct, rectification, 1e-10);
|
||||
}
|
||||
cv::imwrite(cv::format("fisheye_rectification_AB_%03d.png", i), rectification);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, stereoCalibrate)
|
||||
@@ -601,17 +645,17 @@ std::string fisheyeTest::combine(const std::string& _item1, const std::string& _
|
||||
return item1 + (last != '/' ? "/" : "") + item2;
|
||||
}
|
||||
|
||||
cv::Mat fisheyeTest::mergeRectification(const cv::Mat& l, const cv::Mat& r)
|
||||
void fisheyeTest::merge4(const cv::Mat& tl, const cv::Mat& tr, const cv::Mat& bl, const cv::Mat& br, cv::Mat& merged)
|
||||
{
|
||||
CV_Assert(l.type() == r.type() && l.size() == r.size());
|
||||
cv::Mat merged(l.rows, l.cols * 2, l.type());
|
||||
cv::Mat lpart = merged.colRange(0, l.cols);
|
||||
cv::Mat rpart = merged.colRange(l.cols, merged.cols);
|
||||
l.copyTo(lpart);
|
||||
r.copyTo(rpart);
|
||||
int type = tl.type();
|
||||
cv::Size sz = tl.size();
|
||||
ASSERT_EQ(type, tr.type()); ASSERT_EQ(type, bl.type()); ASSERT_EQ(type, br.type());
|
||||
ASSERT_EQ(sz.width, tr.cols); ASSERT_EQ(sz.width, bl.cols); ASSERT_EQ(sz.width, br.cols);
|
||||
ASSERT_EQ(sz.height, tr.rows); ASSERT_EQ(sz.height, bl.rows); ASSERT_EQ(sz.height, br.rows);
|
||||
|
||||
for(int i = 0; i < l.rows; i+=20)
|
||||
cv::line(merged, cv::Point(0, i), cv::Point(merged.cols, i), CV_RGB(0, 255, 0));
|
||||
|
||||
return merged;
|
||||
merged.create(cv::Size(sz.width * 2, sz.height * 2), type);
|
||||
tl.copyTo(merged(cv::Rect(0, 0, sz.width, sz.height)));
|
||||
tr.copyTo(merged(cv::Rect(sz.width, 0, sz.width, sz.height)));
|
||||
bl.copyTo(merged(cv::Rect(0, sz.height, sz.width, sz.height)));
|
||||
bl.copyTo(merged(cv::Rect(sz.width, sz.height, sz.width, sz.height)));
|
||||
}
|
||||
|
||||
@@ -326,9 +326,15 @@ string ERROR_PREFIXES[] = { "borderedAll",
|
||||
"borderedTextureless",
|
||||
"borderedDepthDiscont" }; // size of ERROR_KINDS_COUNT
|
||||
|
||||
string ROI_PREFIXES[] = { "roiX",
|
||||
"roiY",
|
||||
"roiWidth",
|
||||
"roiHeight" };
|
||||
|
||||
|
||||
const string RMS_STR = "RMS";
|
||||
const string BAD_PXLS_FRACTION_STR = "BadPxlsFraction";
|
||||
const string ROI_STR = "ValidDisparityROI";
|
||||
|
||||
class QualityEvalParams
|
||||
{
|
||||
@@ -366,16 +372,20 @@ public:
|
||||
protected:
|
||||
// assumed that left image is a reference image
|
||||
virtual int runStereoMatchingAlgorithm( const Mat& leftImg, const Mat& rightImg,
|
||||
Mat& leftDisp, Mat& rightDisp, int caseIdx ) = 0; // return ignored border width
|
||||
Rect& calcROI, Mat& leftDisp, Mat& rightDisp, int caseIdx ) = 0; // return ignored border width
|
||||
|
||||
int readDatasetsParams( FileStorage& fs );
|
||||
virtual int readRunParams( FileStorage& fs );
|
||||
void writeErrors( const string& errName, const vector<float>& errors, FileStorage* fs = 0 );
|
||||
void writeROI( const Rect& calcROI, FileStorage* fs = 0 );
|
||||
void readErrors( FileNode& fn, const string& errName, vector<float>& errors );
|
||||
void readROI( FileNode& fn, Rect& trueROI );
|
||||
int compareErrors( const vector<float>& calcErrors, const vector<float>& validErrors,
|
||||
const vector<float>& eps, const string& errName );
|
||||
int compareROI( const Rect& calcROI, const Rect& validROI );
|
||||
int processStereoMatchingResults( FileStorage& fs, int caseIdx, bool isWrite,
|
||||
const Mat& leftImg, const Mat& rightImg,
|
||||
const Rect& calcROI,
|
||||
const Mat& trueLeftDisp, const Mat& trueRightDisp,
|
||||
const Mat& leftDisp, const Mat& rightDisp,
|
||||
const QualityEvalParams& qualityEvalParams );
|
||||
@@ -451,6 +461,7 @@ void CV_StereoMatchingTest::run(int)
|
||||
Mat rightImg = imread(datasetFullDirName + RIGHT_IMG_NAME);
|
||||
Mat trueLeftDisp = imread(datasetFullDirName + TRUE_LEFT_DISP_NAME, 0);
|
||||
Mat trueRightDisp = imread(datasetFullDirName + TRUE_RIGHT_DISP_NAME, 0);
|
||||
Rect calcROI;
|
||||
|
||||
if( leftImg.empty() || rightImg.empty() || trueLeftDisp.empty() )
|
||||
{
|
||||
@@ -473,7 +484,7 @@ void CV_StereoMatchingTest::run(int)
|
||||
}
|
||||
|
||||
Mat leftDisp, rightDisp;
|
||||
int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER);
|
||||
int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, calcROI, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER);
|
||||
|
||||
leftDisp.convertTo( tmp, CV_32FC1 );
|
||||
leftDisp = tmp;
|
||||
@@ -484,7 +495,7 @@ void CV_StereoMatchingTest::run(int)
|
||||
tmp.release();
|
||||
|
||||
int tempCode = processStereoMatchingResults( resFS, ci, isWrite,
|
||||
leftImg, rightImg, trueLeftDisp, trueRightDisp, leftDisp, rightDisp, QualityEvalParams(ignBorder));
|
||||
leftImg, rightImg, calcROI, trueLeftDisp, trueRightDisp, leftDisp, rightDisp, QualityEvalParams(ignBorder));
|
||||
code = tempCode==cvtest::TS::OK ? code : tempCode;
|
||||
}
|
||||
|
||||
@@ -538,6 +549,7 @@ void calcErrors( const Mat& leftImg, const Mat& /*rightImg*/,
|
||||
|
||||
int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int caseIdx, bool isWrite,
|
||||
const Mat& leftImg, const Mat& rightImg,
|
||||
const Rect& calcROI,
|
||||
const Mat& trueLeftDisp, const Mat& trueRightDisp,
|
||||
const Mat& leftDisp, const Mat& rightDisp,
|
||||
const QualityEvalParams& qualityEvalParams )
|
||||
@@ -574,6 +586,8 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
|
||||
writeErrors( RMS_STR, rmss, &fs );
|
||||
cvWriteComment( fs.fs, BAD_PXLS_FRACTION_STR.c_str(), 0 );
|
||||
writeErrors( BAD_PXLS_FRACTION_STR, badPxlsFractions, &fs );
|
||||
cvWriteComment( fs.fs, ROI_STR.c_str(), 0 );
|
||||
writeROI( calcROI, &fs );
|
||||
fs << "}"; // datasetName
|
||||
}
|
||||
else // compare
|
||||
@@ -583,16 +597,22 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
|
||||
writeErrors( RMS_STR, rmss );
|
||||
ts->printf( cvtest::TS::LOG, "%s\n", BAD_PXLS_FRACTION_STR.c_str() );
|
||||
writeErrors( BAD_PXLS_FRACTION_STR, badPxlsFractions );
|
||||
ts->printf( cvtest::TS::LOG, "%s\n", ROI_STR.c_str() );
|
||||
writeROI( calcROI );
|
||||
|
||||
FileNode fn = fs.getFirstTopLevelNode()[caseNames[caseIdx]];
|
||||
vector<float> validRmss, validBadPxlsFractions;
|
||||
Rect validROI;
|
||||
|
||||
readErrors( fn, RMS_STR, validRmss );
|
||||
readErrors( fn, BAD_PXLS_FRACTION_STR, validBadPxlsFractions );
|
||||
readROI( fn, validROI );
|
||||
int tempCode = compareErrors( rmss, validRmss, rmsEps, RMS_STR );
|
||||
code = tempCode==cvtest::TS::OK ? code : tempCode;
|
||||
tempCode = compareErrors( badPxlsFractions, validBadPxlsFractions, fracEps, BAD_PXLS_FRACTION_STR );
|
||||
code = tempCode==cvtest::TS::OK ? code : tempCode;
|
||||
tempCode = compareROI( calcROI, validROI );
|
||||
code = tempCode==cvtest::TS::OK ? code : tempCode;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@@ -642,6 +662,24 @@ void CV_StereoMatchingTest::writeErrors( const string& errName, const vector<flo
|
||||
ts->printf( cvtest::TS::LOG, "%s = %f\n", string(ERROR_PREFIXES[i]+errName).c_str(), *it );
|
||||
}
|
||||
|
||||
void CV_StereoMatchingTest::writeROI( const Rect& calcROI, FileStorage* fs )
|
||||
{
|
||||
if( fs )
|
||||
{
|
||||
*fs << ROI_PREFIXES[0] << calcROI.x;
|
||||
*fs << ROI_PREFIXES[1] << calcROI.y;
|
||||
*fs << ROI_PREFIXES[2] << calcROI.width;
|
||||
*fs << ROI_PREFIXES[3] << calcROI.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "%s = %d\n", ROI_PREFIXES[0].c_str(), calcROI.x );
|
||||
ts->printf( cvtest::TS::LOG, "%s = %d\n", ROI_PREFIXES[1].c_str(), calcROI.y );
|
||||
ts->printf( cvtest::TS::LOG, "%s = %d\n", ROI_PREFIXES[2].c_str(), calcROI.width );
|
||||
ts->printf( cvtest::TS::LOG, "%s = %d\n", ROI_PREFIXES[3].c_str(), calcROI.height );
|
||||
}
|
||||
}
|
||||
|
||||
void CV_StereoMatchingTest::readErrors( FileNode& fn, const string& errName, vector<float>& errors )
|
||||
{
|
||||
errors.resize( ERROR_KINDS_COUNT );
|
||||
@@ -650,6 +688,14 @@ void CV_StereoMatchingTest::readErrors( FileNode& fn, const string& errName, vec
|
||||
fn[ERROR_PREFIXES[i]+errName] >> *it;
|
||||
}
|
||||
|
||||
void CV_StereoMatchingTest::readROI( FileNode& fn, Rect& validROI )
|
||||
{
|
||||
fn[ROI_PREFIXES[0]] >> validROI.x;
|
||||
fn[ROI_PREFIXES[1]] >> validROI.y;
|
||||
fn[ROI_PREFIXES[2]] >> validROI.width;
|
||||
fn[ROI_PREFIXES[3]] >> validROI.height;
|
||||
}
|
||||
|
||||
int CV_StereoMatchingTest::compareErrors( const vector<float>& calcErrors, const vector<float>& validErrors,
|
||||
const vector<float>& eps, const string& errName )
|
||||
{
|
||||
@@ -669,6 +715,26 @@ int CV_StereoMatchingTest::compareErrors( const vector<float>& calcErrors, const
|
||||
return ok ? cvtest::TS::OK : cvtest::TS::FAIL_BAD_ACCURACY;
|
||||
}
|
||||
|
||||
int CV_StereoMatchingTest::compareROI( const Rect& calcROI, const Rect& validROI )
|
||||
{
|
||||
int compare[4][2] = {
|
||||
{ calcROI.x, validROI.x },
|
||||
{ calcROI.y, validROI.y },
|
||||
{ calcROI.width, validROI.width },
|
||||
{ calcROI.height, validROI.height },
|
||||
};
|
||||
bool ok = true;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (compare[i][0] != compare[i][1])
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "bad accuracy of %s (valid=%d; calc=%d)\n", ROI_PREFIXES[i].c_str(), compare[i][1], compare[i][0] );
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
return ok ? cvtest::TS::OK : cvtest::TS::FAIL_BAD_ACCURACY;
|
||||
}
|
||||
|
||||
//----------------------------------- StereoBM test -----------------------------------------------------
|
||||
|
||||
class CV_StereoBMTest : public CV_StereoMatchingTest
|
||||
@@ -685,6 +751,7 @@ protected:
|
||||
struct RunParams
|
||||
{
|
||||
int ndisp;
|
||||
int mindisp;
|
||||
int winSize;
|
||||
};
|
||||
vector<RunParams> caseRunParams;
|
||||
@@ -694,12 +761,13 @@ protected:
|
||||
int code = CV_StereoMatchingTest::readRunParams( fs );
|
||||
FileNode fn = fs.getFirstTopLevelNode();
|
||||
assert(fn.isSeq());
|
||||
for( int i = 0; i < (int)fn.size(); i+=4 )
|
||||
for( int i = 0; i < (int)fn.size(); i+=5 )
|
||||
{
|
||||
string caseName = fn[i], datasetName = fn[i+1];
|
||||
RunParams params;
|
||||
string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
|
||||
string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
|
||||
String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
|
||||
String mindisp = fn[i+3]; params.mindisp = atoi(mindisp.c_str());
|
||||
String winSize = fn[i+4]; params.winSize = atoi(winSize.c_str());
|
||||
caseNames.push_back( caseName );
|
||||
caseDatasets.push_back( datasetName );
|
||||
caseRunParams.push_back( params );
|
||||
@@ -708,7 +776,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual int runStereoMatchingAlgorithm( const Mat& _leftImg, const Mat& _rightImg,
|
||||
Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
|
||||
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
|
||||
{
|
||||
RunParams params = caseRunParams[caseIdx];
|
||||
assert( params.ndisp%16 == 0 );
|
||||
@@ -717,7 +785,21 @@ protected:
|
||||
Mat rightImg; cvtColor( _rightImg, rightImg, CV_BGR2GRAY );
|
||||
|
||||
StereoBM bm( StereoBM::BASIC_PRESET, params.ndisp, params.winSize );
|
||||
bm.state->minDisparity = params.mindisp;
|
||||
|
||||
Rect cROI(0, 0, _leftImg.cols, _leftImg.rows);
|
||||
calcROI = getValidDisparityROI(cROI, cROI, params.mindisp, params.ndisp, params.winSize);
|
||||
|
||||
bm( leftImg, rightImg, leftDisp, CV_32F );
|
||||
|
||||
if (params.mindisp != 0)
|
||||
for (int y = 0; y < leftDisp.rows; y++)
|
||||
for (int x = 0; x < leftDisp.cols; x++)
|
||||
{
|
||||
if (leftDisp.at<float>(y, x) < params.mindisp)
|
||||
leftDisp.at<float>(y, x) = -0.0625; // treat disparity < mindisp as no disparity
|
||||
}
|
||||
|
||||
return params.winSize/2;
|
||||
}
|
||||
};
|
||||
@@ -754,7 +836,13 @@ protected:
|
||||
RunParams params;
|
||||
string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
|
||||
string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
|
||||
string fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true;
|
||||
string fullDP = fn[i+4];
|
||||
int n = atoi(fullDP.c_str());
|
||||
params.fullDP = n == 0 ? false : true;
|
||||
|
||||
if (n > 1)
|
||||
continue; // OpenCV 3+ compatibility - skip tests for mode > 1
|
||||
|
||||
caseNames.push_back( caseName );
|
||||
caseDatasets.push_back( datasetName );
|
||||
caseRunParams.push_back( params );
|
||||
@@ -763,12 +851,16 @@ protected:
|
||||
}
|
||||
|
||||
virtual int runStereoMatchingAlgorithm( const Mat& leftImg, const Mat& rightImg,
|
||||
Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
|
||||
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
|
||||
{
|
||||
RunParams params = caseRunParams[caseIdx];
|
||||
assert( params.ndisp%16 == 0 );
|
||||
StereoSGBM sgbm( 0, params.ndisp, params.winSize, 10*params.winSize*params.winSize, 40*params.winSize*params.winSize,
|
||||
1, 63, 10, 100, 32, params.fullDP );
|
||||
|
||||
Rect cROI(0, 0, leftImg.cols, leftImg.rows);
|
||||
calcROI = getValidDisparityROI(cROI, cROI, 0, params.ndisp, params.winSize);
|
||||
|
||||
sgbm( leftImg, rightImg, leftDisp );
|
||||
assert( leftDisp.type() == CV_16SC1 );
|
||||
leftDisp/=16;
|
||||
|
||||
@@ -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 7
|
||||
|
||||
#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
|
||||
|
||||
@@ -2994,6 +2994,7 @@ PCA& PCA::computeVar(InputArray _data, InputArray __mean, int flags, double reta
|
||||
{
|
||||
CV_Assert( _mean.size() == mean_sz );
|
||||
_mean.convertTo(mean, ctype);
|
||||
covar_flags |= CV_COVAR_USE_AVG;
|
||||
}
|
||||
|
||||
calcCovarMatrix( data, covar, mean, covar_flags, ctype );
|
||||
|
||||
+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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user