mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
Compare commits
89 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| f632f5c552 | |||
| f0d592e6b6 | |||
| c585d3890e | |||
| 8577f71810 | |||
| 6f00e53159 | |||
| 422154dc97 | |||
| 50486bd34d | |||
| 1c409abe9c | |||
| c419552002 | |||
| 4e7f28811c | |||
| c7c831bca5 | |||
| 80f03f58e7 | |||
| a34b8d4abf | |||
| 72becbbb1f | |||
| c181f2f493 | |||
| 36db16a00d | |||
| 26a32dcbf6 | |||
| f1009e2234 | |||
| 9ff63a46fc | |||
| c314178e7a | |||
| 3648c61172 |
Vendored
+10
-12
@@ -1,13 +1,11 @@
|
||||
set(HAVE_FFMPEG 1)
|
||||
set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
set(HAVE_FFMPEG_RESAMPLE 0)
|
||||
set(HAVE_GENTOO_FFMPEG 1)
|
||||
set(FFMPEG_libavcodec_FOUND 1)
|
||||
set(FFMPEG_libavformat_FOUND 1)
|
||||
set(FFMPEG_libavutil_FOUND 1)
|
||||
set(FFMPEG_libswscale_FOUND 1)
|
||||
set(FFMPEG_libavresample_FOUND 1)
|
||||
|
||||
set(ALIASOF_libavcodec_VERSION 55.18.102)
|
||||
set(ALIASOF_libavformat_VERSION 55.12.100)
|
||||
set(ALIASOF_libavutil_VERSION 52.38.100)
|
||||
set(ALIASOF_libswscale_VERSION 2.3.100)
|
||||
set(ALIASOF_libavresample_VERSION 1.0.1)
|
||||
set(FFMPEG_libavcodec_VERSION 55.18.102)
|
||||
set(FFMPEG_libavformat_VERSION 55.12.100)
|
||||
set(FFMPEG_libavutil_VERSION 52.38.100)
|
||||
set(FFMPEG_libswscale_VERSION 2.3.100)
|
||||
set(FFMPEG_libavresample_VERSION 1.0.1)
|
||||
|
||||
Vendored
+2
@@ -38,6 +38,8 @@ set_target_properties(${JASPER_LIBRARY}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${JASPER_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${JASPER_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${JASPER_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
-1
@@ -842,7 +842,6 @@ static int jas_cmshapmat_apply(jas_cmpxform_t *pxform, jas_cmreal_t *in,
|
||||
*dst++ = a2;
|
||||
}
|
||||
} else {
|
||||
assert(0);
|
||||
while (--cnt >= 0) {
|
||||
a0 = *src++;
|
||||
src++;
|
||||
|
||||
Vendored
+5
-2
@@ -345,6 +345,7 @@ jas_stream_t *jas_stream_tmpfile()
|
||||
{
|
||||
jas_stream_t *stream;
|
||||
jas_stream_fileobj_t *obj;
|
||||
char *tmpname;
|
||||
|
||||
if (!(stream = jas_stream_create())) {
|
||||
return 0;
|
||||
@@ -365,10 +366,12 @@ jas_stream_t *jas_stream_tmpfile()
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Choose a file name. */
|
||||
tmpnam(obj->pathname);
|
||||
tmpname = tempnam(NULL, NULL);
|
||||
strcpy(obj->pathname, tmpname);
|
||||
free(tmpname);
|
||||
|
||||
/* Open the underlying file. */
|
||||
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
|
||||
if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY | O_TEMPORARY | _O_SHORT_LIVED,
|
||||
JAS_STREAM_PERMS)) < 0) {
|
||||
jas_stream_destroy(stream);
|
||||
return 0;
|
||||
|
||||
Vendored
+2
@@ -31,6 +31,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wshift-negative-value) #
|
||||
set_target_properties(${JPEG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${JPEG_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${JPEG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+2
@@ -49,6 +49,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
|
||||
set_target_properties(${PNG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${PNG_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${PNG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+4
-2
@@ -86,7 +86,7 @@ else()
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
|
||||
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
|
||||
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wmisleading-indentation)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
|
||||
@@ -95,7 +95,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018 /wd4311 /wd4312)
|
||||
|
||||
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
@@ -108,6 +108,8 @@ set_target_properties(${TIFF_LIBRARY}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "${TIFF_LIBRARY}"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${TIFF_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${TIFF_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+9
-2
@@ -37,8 +37,8 @@ endif()
|
||||
source_group("Include" FILES ${lib_hdrs} )
|
||||
source_group("Src" FILES ${lib_srcs})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -Wmissing-declarations -Wuninitialized -Wswitch -Wparentheses -Warray-bounds -Wextra
|
||||
-Wdeprecated-declarations -Wmisleading-indentation)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd4189 /wd4245 /wd4305 /wd4389 /wd4512 /wd4701 /wd4702 /wd4706 /wd4800) # vs2005
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
||||
@@ -49,6 +49,11 @@ if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif()
|
||||
|
||||
if(MSVC AND CV_ICC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qrestrict")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qrestrict")
|
||||
endif()
|
||||
|
||||
add_library(IlmImf STATIC ${lib_hdrs} ${lib_srcs})
|
||||
target_link_libraries(IlmImf ${ZLIB_LIBRARIES})
|
||||
|
||||
@@ -56,6 +61,8 @@ set_target_properties(IlmImf
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "IlmImf"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME "IlmImf"
|
||||
COMPILE_PDB_NAME_DEBUG "IlmImf${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
|
||||
Vendored
+2
@@ -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}
|
||||
)
|
||||
|
||||
|
||||
+34
-27
@@ -73,6 +73,8 @@ endif()
|
||||
|
||||
include(cmake/OpenCVUtils.cmake)
|
||||
|
||||
ocv_cmake_eval(DEBUG_PRE ONCE)
|
||||
|
||||
ocv_clear_vars(OpenCVModules_TARGETS)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -137,7 +139,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 +164,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 )
|
||||
@@ -216,6 +219,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 +278,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 +449,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)
|
||||
@@ -730,6 +732,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 +882,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 +921,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)
|
||||
@@ -1103,3 +1106,7 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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()
|
||||
else()
|
||||
message(STATUS "Looking for ccache - not found")
|
||||
endif()
|
||||
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()
|
||||
@@ -306,8 +345,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 +368,10 @@ if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4589") # Constructor of abstract class ... ignores initializer for virtual base class 'cv::Algorithm'
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4359") # Alignment specifier is less than actual alignment (4), and will be ignored
|
||||
endif()
|
||||
|
||||
if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
|
||||
string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -81,6 +81,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910)
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
@@ -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,7 +38,7 @@ 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()
|
||||
|
||||
@@ -142,6 +138,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910)
|
||||
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()
|
||||
|
||||
|
||||
|
||||
@@ -190,63 +190,35 @@ 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")
|
||||
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 +245,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:
|
||||
@@ -591,7 +591,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()
|
||||
|
||||
|
||||
+136
-18
@@ -1,3 +1,10 @@
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig)
|
||||
endif()
|
||||
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation thess macro should be defined by toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
@@ -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:
|
||||
@@ -41,6 +89,9 @@ function(ocv_include_directories)
|
||||
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,6 +298,44 @@ 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()
|
||||
|
||||
# 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()
|
||||
|
||||
|
||||
# Macros that checks if module have been installed.
|
||||
# After it adds module to build and define
|
||||
@@ -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()
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#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; }
|
||||
@@ -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)
|
||||
|
||||
@@ -53,6 +53,14 @@ Dilation
|
||||
|
||||
The background (bright) dilates around the black regions of the letter.
|
||||
|
||||
To better grasp the idea and avoid possible confusion, in this another example we have inverted the original image such as the object in white is now the letter. We have performed two dilatations with a rectangular structuring element of size :math:`3x3`.
|
||||
|
||||
.. image:: images/Morphology_1_Tutorial_Theory_Dilatation_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting dilatation
|
||||
:align: center
|
||||
|
||||
The dilatation makes the object in white bigger.
|
||||
|
||||
Erosion
|
||||
^^^^^^^^
|
||||
|
||||
@@ -66,6 +74,13 @@ Erosion
|
||||
:alt: Erosion result - Theory example
|
||||
:align: center
|
||||
|
||||
In the same manner, the corresponding image resulting of the erosion operation on the inverted original image (two erosions with a rectangular structuring element of size :math:`3x3`.
|
||||
|
||||
.. image:: images/Morphology_1_Tutorial_Theory_Erosion_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting erosion
|
||||
:align: center
|
||||
|
||||
The erosion makes the object in white smaller.
|
||||
|
||||
Code
|
||||
======
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -31,7 +31,7 @@ In the previous tutorial we covered two basic Morphology operations:
|
||||
* Erosion
|
||||
* Dilation.
|
||||
|
||||
Based on these two we can effectuate more sophisticated transformations to our images. Here we discuss briefly 05 operations offered by OpenCV:
|
||||
Based on these two we can effectuate more sophisticated transformations to our images. Here we discuss briefly 5 operations offered by OpenCV:
|
||||
|
||||
Opening
|
||||
---------
|
||||
@@ -50,6 +50,12 @@ Opening
|
||||
:alt: Opening
|
||||
:align: center
|
||||
|
||||
For the sake of clarity, we have performed the opening operation (:math:`7x7` rectangular structuring element) on the same original image but inverted such as the object in white is now the letter.
|
||||
|
||||
.. image:: images/Morphology_2_Tutorial_Theory_Opening_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting opening
|
||||
:align: center
|
||||
|
||||
Closing
|
||||
---------
|
||||
|
||||
@@ -65,6 +71,11 @@ Closing
|
||||
:alt: Closing example
|
||||
:align: center
|
||||
|
||||
On the inverted image, we have performed the closing operation (:math:`7x7` rectangular structuring element):
|
||||
|
||||
.. image:: images/Morphology_2_Tutorial_Theory_Closing_2.png
|
||||
:alt: Left image: original image inverted, right image: resulting closing
|
||||
:align: center
|
||||
|
||||
Morphological Gradient
|
||||
------------------------
|
||||
|
||||
@@ -70,8 +70,12 @@ Building the OpenCV library from scratch requires a couple of tools installed be
|
||||
.. _CUDA_Toolkit: http://developer.nvidia.com/cuda-downloads
|
||||
.. |OpenEXR| replace:: OpenEXR
|
||||
.. _OpenEXR: http://www.openexr.com/downloads.html
|
||||
.. |OpenNI_Framework| replace:: OpenNI Framework
|
||||
.. _OpenNI_Framework: http://www.openni.org/
|
||||
.. |OpenNI_prebuilt| replace:: OpenNI prebuilt binaries
|
||||
.. _OpenNI_prebuilt: http://structure.io/openni
|
||||
.. |OpenNI_github| replace:: OpenNI Github
|
||||
.. _OpenNI_github: https://github.com/OpenNI/OpenNI
|
||||
.. |OpenNI2_github| replace:: OpenNI2 Github
|
||||
.. _OpenNI2_github: https://github.com/OpenNI/OpenNI2
|
||||
.. |Miktex| replace:: Miktex
|
||||
.. _Miktex: http://miktex.org/2.9/setup
|
||||
.. |Sphinx| replace:: Sphinx
|
||||
@@ -105,7 +109,7 @@ OpenCV may come in multiple flavors. There is a "core" section that will work on
|
||||
|
||||
+ |OpenEXR|_ source files are required for the library to work with this high dynamic range (HDR) image file format.
|
||||
|
||||
+ The |OpenNI_Framework|_ contains a set of open source APIs that provide support for natural interaction with devices via methods such as voice command recognition, hand gestures and body motion tracking.
|
||||
+ The OpenNI Framework contains a set of open source APIs that provide support for natural interaction with devices via methods such as voice command recognition, hand gestures and body motion tracking. |OpenNI_prebuilt|_ , |OpenNI_github|_ code and |OpenNI2_github|_ code is available.
|
||||
|
||||
+ |Miktex|_ is the best `TEX <https://secure.wikimedia.org/wikipedia/en/wiki/TeX>`_ implementation on the Windows OS. It is required to build the *OpenCV documentation*.
|
||||
|
||||
@@ -172,7 +176,7 @@ Building the library
|
||||
|
||||
#) Same as above with |OpenEXR|_.
|
||||
|
||||
#) For the |OpenNI_Framework|_ you need to install both the `development build <http://www.openni.org/downloadfiles/opennimodules/openni-binaries/21-stable>`_ and the `PrimeSensor Module <http://www.openni.org/downloadfiles/opennimodules/openni-compliant-hardware-binaries/32-stable>`_.
|
||||
#) For the |OpenNI_prebuilt|_ you need to install both the `development build <http://www.openni.org/downloadfiles/opennimodules/openni-binaries/21-stable>`_ and the `PrimeSensor Module <http://www.openni.org/downloadfiles/opennimodules/openni-compliant-hardware-binaries/32-stable>`_.
|
||||
|
||||
#) For the CUDA you need again two modules: the latest |CUDA_Toolkit|_ and the *CUDA Tools SDK*. Download and install both of them with a *complete* option by using the 32 or 64 bit setups according to your OS.
|
||||
|
||||
|
||||
@@ -83,7 +83,14 @@ is extended as:
|
||||
:math:`k_6` are radial distortion coefficients.
|
||||
:math:`p_1` and
|
||||
:math:`p_2` are tangential distortion coefficients.
|
||||
Higher-order coefficients are not considered in OpenCV. In the functions below the coefficients are passed or returned as
|
||||
Higher-order coefficients are not considered in OpenCV.
|
||||
|
||||
The next figure shows two common types of radial distortion: barrel distortion (typically :math:`k_1 > 0` and pincushion distortion (typically :math:`k_1 < 0`).
|
||||
|
||||
.. image:: pics/distortion_examples.png
|
||||
:align: center
|
||||
|
||||
In the functions below the coefficients are passed or returned as
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -1036,13 +1036,15 @@ icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0)
|
||||
q->neighbors[j] = 0;
|
||||
q->count--;
|
||||
for(int k = 0; k < 4; k++ )
|
||||
{
|
||||
if( q0->neighbors[k] == q )
|
||||
{
|
||||
q0->neighbors[k] = 0;
|
||||
q0->count--;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ CV_IMPL void cvProjectPoints2( const CvMat* objectPoints,
|
||||
{
|
||||
if( dpdc_p )
|
||||
{
|
||||
dpdc_p[0] = 1; dpdc_p[1] = 0;
|
||||
dpdc_p[0] = 1; dpdc_p[1] = 0; // dp_xdc_x; dp_xdc_y
|
||||
dpdc_p[dpdc_step] = 0;
|
||||
dpdc_p[dpdc_step+1] = 1;
|
||||
dpdc_p += dpdc_step*2;
|
||||
@@ -1024,7 +1024,7 @@ CV_IMPL void cvProjectPoints2( const CvMat* objectPoints,
|
||||
{
|
||||
if( fixedAspectRatio )
|
||||
{
|
||||
dpdf_p[0] = 0; dpdf_p[1] = xd*aspectRatio;
|
||||
dpdf_p[0] = 0; dpdf_p[1] = xd*aspectRatio; // dp_xdf_x; dp_xdf_y
|
||||
dpdf_p[dpdf_step] = 0;
|
||||
dpdf_p[dpdf_step+1] = yd;
|
||||
}
|
||||
@@ -1614,6 +1614,8 @@ CV_IMPL double cvCalibrateCamera2( const CvMat* objectPoints,
|
||||
param[4] = k[0]; param[5] = k[1]; param[6] = k[2]; param[7] = k[3];
|
||||
param[8] = k[4]; param[9] = k[5]; param[10] = k[6]; param[11] = k[7];
|
||||
|
||||
if(flags & CALIB_FIX_ASPECT_RATIO)
|
||||
mask[0] = 0;
|
||||
if( flags & CV_CALIB_FIX_FOCAL_LENGTH )
|
||||
mask[0] = mask[1] = 0;
|
||||
if( flags & CV_CALIB_FIX_PRINCIPAL_POINT )
|
||||
|
||||
@@ -369,6 +369,12 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted
|
||||
double scale = 1.0;
|
||||
|
||||
double theta_d = sqrt(pw[0]*pw[0] + pw[1]*pw[1]);
|
||||
|
||||
// the current camera model is only valid up to 180° FOV
|
||||
// for larger FOV the loop below does not converge
|
||||
// clip values so we still get plausible results for super fisheye images > 180°
|
||||
theta_d = min(max(-CV_PI/2., theta_d), CV_PI/2.);
|
||||
|
||||
if (theta_d > 1e-8)
|
||||
{
|
||||
// compensate distortion iteratively
|
||||
@@ -1028,8 +1034,10 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO
|
||||
int a = cv::countNonZero(intrinsicLeft.isEstimate);
|
||||
int b = cv::countNonZero(intrinsicRight.isEstimate);
|
||||
cv::Mat deltas = J2_inv * J.t() * e;
|
||||
intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a);
|
||||
intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b);
|
||||
if (a > 0)
|
||||
intrinsicLeft = intrinsicLeft + deltas.rowRange(0, a);
|
||||
if (b > 0)
|
||||
intrinsicRight = intrinsicRight + deltas.rowRange(a, a + b);
|
||||
omcur = omcur + cv::Vec3d(deltas.rowRange(a + b, a + b + 3));
|
||||
Tcur = Tcur + cv::Vec3d(deltas.rowRange(a + b + 3, a + b + 6));
|
||||
for (int image_idx = 0; image_idx < n_images; ++image_idx)
|
||||
|
||||
@@ -1339,6 +1339,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
|
||||
|
||||
undistortPoints(Mat(pts), upts, M, D, R, P );
|
||||
for( k = 0; k < N*N; k++ )
|
||||
{
|
||||
if( upts[k].x < -imgsize.width*eps || upts[k].x > imgsize.width*(1+eps) ||
|
||||
upts[k].y < -imgsize.height*eps || upts[k].y > imgsize.height*(1+eps) )
|
||||
{
|
||||
@@ -1346,6 +1347,7 @@ bool CV_StereoCalibrationTest::checkPandROI( int test_case_idx, const Mat& M, co
|
||||
test_case_idx, pts[k].x, pts[k].y, upts[k].x, upts[k].y);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// step 2. check that all the points inside ROI belong to the original source image
|
||||
Mat temp(imgsize, CV_8U), utemp, map1, map2;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -910,8 +910,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;
|
||||
|
||||
|
||||
@@ -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__)
|
||||
|
||||
@@ -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 2
|
||||
|
||||
#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,
|
||||
|
||||
@@ -1845,7 +1845,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
|
||||
|
||||
+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
|
||||
|
||||
@@ -4277,6 +4277,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. */
|
||||
|
||||
@@ -908,6 +908,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 +928,10 @@ struct Mutex::Impl
|
||||
int refcount;
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#elif defined __linux__ && !defined ANDROID && !defined __LINUXTHREADS_OLD__
|
||||
|
||||
struct Mutex::Impl
|
||||
|
||||
@@ -52,9 +52,6 @@ using namespace std;
|
||||
|
||||
#define sign(a) a > 0 ? 1 : a == 0 ? 0 : -1
|
||||
|
||||
const int FLOAT_TYPE [2] = {CV_32F, CV_64F};
|
||||
const int INT_TYPE [5] = {CV_8U, CV_8S, CV_16U, CV_16S, CV_32S};
|
||||
|
||||
#define MAX_WIDTH 100
|
||||
#define MAX_HEIGHT 100
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static void cvTsSimpleSeqShiftAndCopy( CvTsSimpleSeq* seq, int from_idx, int to_
|
||||
(seq->count - from_idx)*elem_size );
|
||||
}
|
||||
seq->count += to_idx - from_idx;
|
||||
if( elem && to_idx > from_idx )
|
||||
if( elem )
|
||||
memcpy( seq->array + from_idx*elem_size, elem, (to_idx - from_idx)*elem_size );
|
||||
}
|
||||
|
||||
|
||||
@@ -419,9 +419,6 @@ static void fixCCS( Mat& mat, int cols, int flags )
|
||||
}
|
||||
}
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
{
|
||||
dst.create(src1.rows, src1.cols, src1.type());
|
||||
@@ -430,12 +427,27 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
CV_Assert( src1.size == src2.size && src1.type() == src2.type() &&
|
||||
(src1.type() == CV_32FC2 || src1.type() == CV_64FC2) );
|
||||
|
||||
const Mat* src1_ = &src1;
|
||||
Mat src1_tmp;
|
||||
if (dst.data == src1.data)
|
||||
{
|
||||
src1_tmp = src1.clone();
|
||||
src1_ = &src1_tmp;
|
||||
}
|
||||
const Mat* src2_ = &src2;
|
||||
Mat src2_tmp;
|
||||
if (dst.data == src2.data)
|
||||
{
|
||||
src2_tmp = src2.clone();
|
||||
src2_ = &src2_tmp;
|
||||
}
|
||||
|
||||
for( i = 0; i < dst.rows; i++ )
|
||||
{
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
const float* a = src1.ptr<float>(i);
|
||||
const float* b = src2.ptr<float>(i);
|
||||
const float* a = src1_->ptr<float>(i);
|
||||
const float* b = src2_->ptr<float>(i);
|
||||
float* c = dst.ptr<float>(i);
|
||||
|
||||
if( !(flags & CV_DXT_MUL_CONJ) )
|
||||
@@ -459,8 +471,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* a = src1.ptr<double>(i);
|
||||
const double* b = src2.ptr<double>(i);
|
||||
const double* a = src1_->ptr<double>(i);
|
||||
const double* b = src2_->ptr<double>(i);
|
||||
double* c = dst.ptr<double>(i);
|
||||
|
||||
if( !(flags & CV_DXT_MUL_CONJ) )
|
||||
@@ -484,9 +496,6 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -778,6 +787,7 @@ public:
|
||||
protected:
|
||||
void run_func();
|
||||
void prepare_to_validation( int test_case_idx );
|
||||
double get_success_error_level( int test_case_idx, int i, int j );
|
||||
};
|
||||
|
||||
|
||||
@@ -785,6 +795,19 @@ CxCore_MulSpectrumsTest::CxCore_MulSpectrumsTest() : CxCore_DXTBaseTest( true, t
|
||||
{
|
||||
}
|
||||
|
||||
double CxCore_MulSpectrumsTest::get_success_error_level( int test_case_idx, int i, int j )
|
||||
{
|
||||
(void)test_case_idx;
|
||||
CV_Assert(i == OUTPUT);
|
||||
CV_Assert(j == 0);
|
||||
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
|
||||
CV_Assert(elem_depth == CV_32F || elem_depth == CV_64F);
|
||||
|
||||
element_wise_relative_error = false;
|
||||
double maxInputValue = 1000; // ArrayTest::get_minmax_bounds
|
||||
double err = 8 * maxInputValue; // result = A*B + C*D
|
||||
return (elem_depth == CV_32F ? FLT_EPSILON : DBL_EPSILON) * err;
|
||||
}
|
||||
|
||||
void CxCore_MulSpectrumsTest::run_func()
|
||||
{
|
||||
|
||||
@@ -736,7 +736,9 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
|
||||
//ROI handling
|
||||
const int HARRIS_BLOCK_SIZE = 9;
|
||||
int halfPatchSize = patchSize / 2;
|
||||
int border = std::max(edgeThreshold, std::max(halfPatchSize, HARRIS_BLOCK_SIZE/2))+1;
|
||||
// sqrt(2.0) is for handling patch rotation
|
||||
int descPatchSize = cvCeil(halfPatchSize*sqrt(2.0));
|
||||
int border = std::max(edgeThreshold, std::max(descPatchSize, HARRIS_BLOCK_SIZE/2))+1;
|
||||
|
||||
Mat image = _image.getMat(), mask = _mask.getMat();
|
||||
if( image.type() != CV_8UC1 )
|
||||
|
||||
@@ -80,7 +80,7 @@ struct big_any_policy : typed_base_any_policy<T>
|
||||
{
|
||||
virtual void static_delete(void** x)
|
||||
{
|
||||
if (* x) delete (* reinterpret_cast<T**>(x)); *x = NULL;
|
||||
if (* x) { delete (* reinterpret_cast<T**>(x)); *x = NULL; }
|
||||
}
|
||||
virtual void copy_from_value(void const* src, void** dest)
|
||||
{
|
||||
|
||||
@@ -225,43 +225,49 @@ int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& di
|
||||
* @deprecated Use GenericIndex class instead
|
||||
*/
|
||||
template <typename T>
|
||||
class
|
||||
#ifndef _MSC_VER
|
||||
FLANN_DEPRECATED
|
||||
#endif
|
||||
Index_ {
|
||||
class Index_ {
|
||||
public:
|
||||
typedef typename L2<T>::ElementType ElementType;
|
||||
typedef typename L2<T>::ResultType DistanceType;
|
||||
|
||||
FLANN_DEPRECATED
|
||||
Index_(const Mat& features, const ::cvflann::IndexParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
~Index_();
|
||||
|
||||
FLANN_DEPRECATED
|
||||
void knnSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
|
||||
FLANN_DEPRECATED
|
||||
void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int radiusSearch(const vector<ElementType>& query, vector<int>& indices, vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
|
||||
FLANN_DEPRECATED
|
||||
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
|
||||
|
||||
FLANN_DEPRECATED
|
||||
void save(std::string filename)
|
||||
{
|
||||
if (nnIndex_L1) nnIndex_L1->save(filename);
|
||||
if (nnIndex_L2) nnIndex_L2->save(filename);
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int veclen() const
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->veclen();
|
||||
if (nnIndex_L2) return nnIndex_L2->veclen();
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
int size() const
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->size();
|
||||
if (nnIndex_L2) return nnIndex_L2->size();
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED
|
||||
::cvflann::IndexParams getParameters()
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->getParameters();
|
||||
@@ -269,7 +275,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters()
|
||||
FLANN_DEPRECATED
|
||||
const ::cvflann::IndexParams* getIndexParameters()
|
||||
{
|
||||
if (nnIndex_L1) return nnIndex_L1->getIndexParameters();
|
||||
if (nnIndex_L2) return nnIndex_L2->getIndexParameters();
|
||||
@@ -281,10 +288,6 @@ private:
|
||||
::cvflann::Index< L1<ElementType> >* nnIndex_L1;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template <typename T>
|
||||
class FLANN_DEPRECATED Index_;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
Index_<T>::Index_(const Mat& dataset, const ::cvflann::IndexParams& params)
|
||||
|
||||
@@ -22,6 +22,8 @@ source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})
|
||||
source_group("Device" FILES ${lib_device_hdrs})
|
||||
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail})
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-private-field)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp" "src/nvidia/*.h*")
|
||||
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
|
||||
@@ -29,7 +31,7 @@ if(HAVE_CUDA)
|
||||
|
||||
source_group("Src\\NVidia" FILES ${ncv_files})
|
||||
ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter -Wstrict-aliasing /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
|
||||
// std::auto_ptr
|
||||
#if defined(__GNUC__) && __GNUC__ >= 6
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
namespace cv { namespace gpu {
|
||||
|
||||
//////////////////////////////// CudaMem ////////////////////////////////
|
||||
@@ -2527,4 +2533,8 @@ CV_EXPORTS void calcWobbleSuppressionMaps(
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 6
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCV_GPU_HPP__ */
|
||||
|
||||
@@ -59,6 +59,11 @@
|
||||
#ifndef _ncvhaarobjectdetection_hpp_
|
||||
#define _ncvhaarobjectdetection_hpp_
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "NCV.hpp"
|
||||
|
||||
@@ -458,5 +463,8 @@ NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename,
|
||||
NCVVector<HaarFeature64> &h_HaarFeatures);
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // _ncvhaarobjectdetection_hpp_
|
||||
|
||||
@@ -215,8 +215,13 @@ if(HAVE_IMAGEIO AND IOS)
|
||||
endif()
|
||||
|
||||
if(HAVE_AVFOUNDATION)
|
||||
list(APPEND highgui_srcs src/cap_avfoundation.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
|
||||
if(IOS)
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
|
||||
else()
|
||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation_mac.mm)
|
||||
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa" "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_QUICKTIME)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -907,10 +907,10 @@ b = b > 255 ? 255 : b
|
||||
uyv2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels + (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y, u, v;
|
||||
register int r, g, b;
|
||||
int i = NumPixels + (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
v = src[i--] - 128;
|
||||
@@ -927,10 +927,10 @@ uyv2bgr(const unsigned char *src, unsigned char *dest,
|
||||
uyvy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y0, y1, u, v;
|
||||
register int r, g, b;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y0, y1, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
y1 = src[i--];
|
||||
@@ -953,10 +953,10 @@ uyvy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
uyyvyy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels + (NumPixels >> 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y0, y1, y2, y3, u, v;
|
||||
register int r, g, b;
|
||||
int i = NumPixels + (NumPixels >> 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y0, y1, y2, y3, u, v;
|
||||
int r, g, b;
|
||||
|
||||
while (i > 0) {
|
||||
y3 = src[i--];
|
||||
@@ -988,9 +988,9 @@ uyyvyy2bgr(const unsigned char *src, unsigned char *dest,
|
||||
y2bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels)
|
||||
{
|
||||
register int i = NumPixels - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = NumPixels - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
@@ -1004,9 +1004,9 @@ y2bgr(const unsigned char *src, unsigned char *dest,
|
||||
y162bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels, int bits)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
@@ -1022,9 +1022,9 @@ y162bgr(const unsigned char *src, unsigned char *dest,
|
||||
rgb482bgr(const unsigned char *src, unsigned char *dest,
|
||||
unsigned long long int NumPixels, int bits)
|
||||
{
|
||||
register int i = (NumPixels << 1) - 1;
|
||||
register int j = NumPixels + (NumPixels << 1) - 1;
|
||||
register int y;
|
||||
int i = (NumPixels << 1) - 1;
|
||||
int j = NumPixels + (NumPixels << 1) - 1;
|
||||
int y;
|
||||
|
||||
while (i > 0) {
|
||||
y = src[i--];
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#define HAVE_FFMPEG_SWSCALE
|
||||
#define HAVE_GENTOO_FFMPEG
|
||||
|
||||
#include "cap_ffmpeg_api.hpp"
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
@@ -1482,6 +1485,10 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(52, 42, 0)
|
||||
st->avg_frame_rate = (AVRational){frame_rate, frame_rate_base};
|
||||
#endif
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
@@ -380,12 +380,11 @@ static void icvInitCapture_V4L() {
|
||||
deviceHandle = open(deviceName, O_RDONLY);
|
||||
if (deviceHandle != -1) {
|
||||
/* This device does indeed exist - add it to the total so far */
|
||||
// add indexList
|
||||
indexList|=(1 << CameraNumber);
|
||||
numCameras++;
|
||||
}
|
||||
if (deviceHandle != -1)
|
||||
close(deviceHandle);
|
||||
// add indexList
|
||||
indexList|=(1 << CameraNumber);
|
||||
numCameras++;
|
||||
close(deviceHandle);
|
||||
}
|
||||
/* Set up to test the next /dev/video source in line */
|
||||
CameraNumber++;
|
||||
} /* End while */
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#ifdef HAVE_JASPER
|
||||
|
||||
#include "grfmt_jpeg2000.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#ifdef WIN32
|
||||
#define JAS_WIN_MSVC_BUILD 1
|
||||
@@ -159,6 +160,21 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
jas_stream_t* stream = (jas_stream_t*)m_stream;
|
||||
jas_image_t* image = (jas_image_t*)m_image;
|
||||
|
||||
#ifndef WIN32
|
||||
// At least on some Linux instances the
|
||||
// system libjasper segfaults when
|
||||
// converting color to grey.
|
||||
// We do this conversion manually at the end.
|
||||
Mat clr;
|
||||
if (CV_MAT_CN(img.type()) < CV_MAT_CN(this->type()))
|
||||
{
|
||||
clr.create(img.size().height, img.size().width, this->type());
|
||||
color = true;
|
||||
data = clr.ptr();
|
||||
step = (int)clr.step;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( stream && image )
|
||||
{
|
||||
bool convert;
|
||||
@@ -171,7 +187,7 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
else
|
||||
{
|
||||
convert = (jas_clrspc_fam( jas_image_clrspc( image ) ) != JAS_CLRSPC_FAM_GRAY);
|
||||
colorspace = JAS_CLRSPC_SGRAY; // TODO GENGRAY or SGRAY?
|
||||
colorspace = JAS_CLRSPC_SGRAY; // TODO GENGRAY or SGRAY? (GENGRAY fails on Win.)
|
||||
}
|
||||
|
||||
// convert to the desired colorspace
|
||||
@@ -256,6 +272,13 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
|
||||
close();
|
||||
|
||||
#ifndef WIN32
|
||||
if (!clr.empty())
|
||||
{
|
||||
cv::cvtColor(clr, img, COLOR_BGR2GRAY);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -480,9 +480,13 @@ CV_IMPL int cvStartWindowThread(){
|
||||
// conditional that indicates a key has been pressed
|
||||
cond_have_key = g_cond_new();
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 32, 0)
|
||||
// this is the window update thread
|
||||
window_thread = g_thread_create((GThreadFunc) icvWindowThreadLoop,
|
||||
NULL, TRUE, NULL);
|
||||
#else
|
||||
window_thread = g_thread_new("OpenCV window update", (GThreadFunc)icvWindowThreadLoop, NULL);
|
||||
#endif
|
||||
}
|
||||
thread_started = window_thread!=NULL;
|
||||
return thread_started;
|
||||
|
||||
@@ -1271,7 +1271,7 @@ Morphological gradient:
|
||||
|
||||
\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}
|
||||
|
||||
"Hit and Miss": Only supported for CV_8UC1 binary images. Tutorial can be found in this page: http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/
|
||||
"Hit and Miss": Only supported for CV_8UC1 binary images. Tutorial can be found in this page: https://web.archive.org/web/20160316070407/http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/
|
||||
|
||||
Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.
|
||||
|
||||
|
||||
@@ -70,5 +70,5 @@ PERF_TEST_P( Image_KernelSize, GaborFilter2d,
|
||||
filter2D(sourceImage, filteredImage, CV_32F, gaborKernel);
|
||||
}
|
||||
|
||||
SANITY_CHECK(filteredImage, 1e-3);
|
||||
SANITY_CHECK(filteredImage, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
@@ -284,10 +284,13 @@ cvStartFindContours( void* _img, CvMemStorage* storage,
|
||||
scanner->cinfo_storage );
|
||||
}
|
||||
|
||||
CV_Assert(step >= 0);
|
||||
CV_Assert(size.height >= 1);
|
||||
|
||||
/* make zero borders */
|
||||
int esz = CV_ELEM_SIZE(mat->type);
|
||||
memset( img, 0, size.width*esz );
|
||||
memset( img + step * (size.height - 1), 0, size.width*esz );
|
||||
memset( img + static_cast<size_t>(step) * (size.height - 1), 0, size.width*esz );
|
||||
|
||||
img += step;
|
||||
for( int y = 1; y < size.height - 1; y++, img += step )
|
||||
@@ -989,6 +992,8 @@ cvFindNextContour( CvContourScanner scanner )
|
||||
{
|
||||
if( !scanner )
|
||||
CV_Error( CV_StsNullPtr, "" );
|
||||
CV_Assert(scanner->img_step >= 0);
|
||||
|
||||
icvEndProcessContour( scanner );
|
||||
|
||||
/* initialize local state */
|
||||
@@ -1063,7 +1068,7 @@ cvFindNextContour( CvContourScanner scanner )
|
||||
is_hole = 1;
|
||||
}
|
||||
|
||||
if( mode == 0 && (is_hole || img0[lnbd.y * step + lnbd.x] > 0) )
|
||||
if( mode == 0 && (is_hole || img0[lnbd.y * static_cast<size_t>(step) + lnbd.x] > 0) )
|
||||
goto resume_scan;
|
||||
|
||||
origin.y = y;
|
||||
@@ -1077,8 +1082,8 @@ cvFindNextContour( CvContourScanner scanner )
|
||||
else
|
||||
{
|
||||
int lval = (img0_i ?
|
||||
img0_i[lnbd.y * step_i + lnbd.x] :
|
||||
(int)img0[lnbd.y * step + lnbd.x]) & 0x7f;
|
||||
img0_i[lnbd.y * static_cast<size_t>(step_i) + lnbd.x] :
|
||||
(int)img0[lnbd.y * static_cast<size_t>(step) + lnbd.x]) & 0x7f;
|
||||
_CvContourInfo *cur = scanner->cinfo_table[lval];
|
||||
|
||||
/* find the first bounding contour */
|
||||
@@ -1090,11 +1095,11 @@ cvFindNextContour( CvContourScanner scanner )
|
||||
if( par_info )
|
||||
{
|
||||
if( (img0_i &&
|
||||
icvTraceContour_32s( img0_i + par_info->origin.y * step_i +
|
||||
icvTraceContour_32s( img0_i + par_info->origin.y * static_cast<size_t>(step_i) +
|
||||
par_info->origin.x, step_i, img_i + lnbd.x,
|
||||
par_info->is_hole ) > 0) ||
|
||||
(!img0_i &&
|
||||
icvTraceContour( img0 + par_info->origin.y * step +
|
||||
icvTraceContour( img0 + par_info->origin.y * static_cast<size_t>(step) +
|
||||
par_info->origin.x, step, img + lnbd.x,
|
||||
par_info->is_hole ) > 0) )
|
||||
break;
|
||||
|
||||
@@ -167,6 +167,9 @@ static void divSpectrums( InputArray _srcA, InputArray _srcB, OutputArray _dst,
|
||||
_dst.create( srcA.rows, srcA.cols, type );
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
CV_Assert(dst.data != srcA.data); // non-inplace check
|
||||
CV_Assert(dst.data != srcB.data); // non-inplace check
|
||||
|
||||
bool is_1d = (flags & DFT_ROWS) || (rows == 1 || (cols == 1 &&
|
||||
srcA.isContinuous() && srcB.isContinuous() && dst.isContinuous()));
|
||||
|
||||
|
||||
@@ -286,6 +286,9 @@ else(ANDROID)
|
||||
endif(ANDROID)
|
||||
|
||||
# step 5: build native part
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-const-variable -Woverloaded-virtual)
|
||||
|
||||
|
||||
add_library(${the_module} SHARED ${handwrittren_h_sources} ${handwrittren_cpp_sources} ${generated_cpp_sources}
|
||||
${copied_files}
|
||||
"${JAR_FILE}" "${JAR_FILE}.dephelper")
|
||||
|
||||
@@ -26,6 +26,11 @@ import org.opencv.highgui.Highgui;
|
||||
import android.util.Log;
|
||||
|
||||
public class OpenCVTestCase extends TestCase {
|
||||
|
||||
public static class TestSkipException extends RuntimeException {
|
||||
public TestSkipException() {}
|
||||
}
|
||||
|
||||
//change to 'true' to unblock fail on fail("Not yet implemented")
|
||||
public static final boolean passNYI = true;
|
||||
|
||||
@@ -182,12 +187,40 @@ public class OpenCVTestCase extends TestCase {
|
||||
protected void runTest() throws Throwable {
|
||||
// Do nothing if the precondition does not hold.
|
||||
if (isTestCaseEnabled) {
|
||||
super.runTest();
|
||||
try {
|
||||
super.runTest();
|
||||
} catch (TestSkipException ex) {
|
||||
Log.w(TAG, "Test case \"" + this.getClass().getName() + "\" skipped!");
|
||||
assertTrue(true);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Test case \"" + this.getClass().getName() + "\" disabled!");
|
||||
}
|
||||
}
|
||||
|
||||
public void runBare() throws Throwable {
|
||||
Throwable exception = null;
|
||||
try {
|
||||
setUp();
|
||||
} catch (TestSkipException ex) {
|
||||
Log.w(TAG, "Test case \"" + this.getClass().getName() + "\" skipped!");
|
||||
assertTrue(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
runTest();
|
||||
} catch (Throwable running) {
|
||||
exception = running;
|
||||
} finally {
|
||||
try {
|
||||
tearDown();
|
||||
} catch (Throwable tearingDown) {
|
||||
if (exception == null) exception = tearingDown;
|
||||
}
|
||||
}
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
protected Mat getMat(int type, double... vals)
|
||||
{
|
||||
return new Mat(matSize, matSize, type, new Scalar(vals));
|
||||
@@ -205,6 +238,10 @@ public class OpenCVTestCase extends TestCase {
|
||||
TestCase.fail(msg);
|
||||
}
|
||||
|
||||
public static void assertGE(double v1, double v2) {
|
||||
assertTrue("Failed: " + v1 + " >= " + v2, v1 >= v2);
|
||||
}
|
||||
|
||||
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2) {
|
||||
if (list1.size() != list2.size()) {
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -419,10 +456,10 @@ public class OpenCVTestCase extends TestCase {
|
||||
|
||||
if (isEqualityMeasured)
|
||||
assertTrue("Max difference between expected and actiual Mats is "+ maxDiff + ", that bigger than " + eps,
|
||||
Core.checkRange(diff, true, 0.0, eps));
|
||||
maxDiff <= eps);
|
||||
else
|
||||
assertFalse("Max difference between expected and actiual Mats is "+ maxDiff + ", that less than " + eps,
|
||||
Core.checkRange(diff, true, 0.0, eps));
|
||||
maxDiff <= eps);
|
||||
}
|
||||
|
||||
protected static String readFile(String path) {
|
||||
|
||||
@@ -249,9 +249,22 @@ public class Calib3dTest extends OpenCVTestCase {
|
||||
|
||||
Mat fm = Calib3d.findFundamentalMat(pts, pts);
|
||||
|
||||
truth = new Mat(3, 3, CvType.CV_64F);
|
||||
truth.put(0, 0, 0, -0.577, 0.288, 0.577, 0, 0.288, -0.288, -0.288, 0);
|
||||
assertMatEqual(truth, fm, EPS);
|
||||
// Check definition of fundamental matrix:
|
||||
// [p2; 1]T * F * [p1; 1] = 0
|
||||
// (p2 == p1 in this testcase)
|
||||
for (int i = 0; i < pts.rows(); i++)
|
||||
{
|
||||
Mat pt = new Mat(3, 1, fm.type());
|
||||
pt.put(0, 0, pts.get(i, 0)[0], pts.get(i, 0)[1], 1);
|
||||
|
||||
Mat pt_t = pt.t();
|
||||
|
||||
Mat tmp = new Mat();
|
||||
Mat res = new Mat();
|
||||
Core.gemm(pt_t, fm, 1.0, new Mat(), 0.0, tmp);
|
||||
Core.gemm(tmp, pt, 1.0, new Mat(), 0.0, res);
|
||||
assertTrue(Math.abs(res.get(0, 0)[0]) <= 1e-6);
|
||||
}
|
||||
}
|
||||
|
||||
public void testFindFundamentalMatListOfPointListOfPointInt() {
|
||||
|
||||
@@ -2052,7 +2052,7 @@ public class CoreTest extends OpenCVTestCase {
|
||||
};
|
||||
Mat roots = new Mat();
|
||||
|
||||
assertEquals(0.0, Core.solvePoly(coeffs, roots));
|
||||
assertGE(1e-6, Math.abs(Core.solvePoly(coeffs, roots)));
|
||||
|
||||
truth = new Mat(3, 1, CvType.CV_32FC2) {
|
||||
{
|
||||
|
||||
@@ -488,13 +488,13 @@ public class MatTest extends OpenCVTestCase {
|
||||
public void testIsContinuous() {
|
||||
assertTrue(gray0.isContinuous());
|
||||
|
||||
Mat subMat = gray0.submat(0, 0, gray0.rows() / 2, gray0.cols() / 2);
|
||||
Mat subMat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
|
||||
assertFalse(subMat.isContinuous());
|
||||
}
|
||||
|
||||
public void testIsSubmatrix() {
|
||||
assertFalse(gray0.isSubmatrix());
|
||||
Mat subMat = gray0.submat(0, 0, gray0.rows() / 2, gray0.cols() / 2);
|
||||
Mat subMat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
|
||||
assertTrue(subMat.isSubmatrix());
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ public class ImgprocTest extends OpenCVTestCase {
|
||||
|
||||
double arcLength = Imgproc.arcLength(curve, false);
|
||||
|
||||
assertEquals(5.656854152679443, arcLength);
|
||||
assertEquals(5.656854152679443, arcLength, EPS);
|
||||
}
|
||||
|
||||
public void testBilateralFilterMatMatIntDoubleDouble() {
|
||||
@@ -367,7 +367,7 @@ public class ImgprocTest extends OpenCVTestCase {
|
||||
|
||||
double distance = Imgproc.compareHist(H1, H2, Imgproc.CV_COMP_CORREL);
|
||||
|
||||
assertEquals(1., distance);
|
||||
assertEquals(1., distance, EPS);
|
||||
}
|
||||
|
||||
public void testContourAreaMat() {
|
||||
@@ -376,7 +376,7 @@ public class ImgprocTest extends OpenCVTestCase {
|
||||
|
||||
double area = Imgproc.contourArea(contour);
|
||||
|
||||
assertEquals(45., area);
|
||||
assertEquals(45., area, EPS);
|
||||
}
|
||||
|
||||
public void testContourAreaMatBoolean() {
|
||||
@@ -385,7 +385,7 @@ public class ImgprocTest extends OpenCVTestCase {
|
||||
|
||||
double area = Imgproc.contourArea(contour, true);
|
||||
|
||||
assertEquals(45., area);
|
||||
assertEquals(45., area, EPS);
|
||||
// TODO_: write better test
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +328,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
|
||||
@Override
|
||||
public void run() {
|
||||
do {
|
||||
boolean hasFrame = false;
|
||||
synchronized (JavaCameraView.this) {
|
||||
try {
|
||||
while (!mCameraFrameReady && !mStopThread) {
|
||||
@@ -337,11 +338,14 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (mCameraFrameReady)
|
||||
{
|
||||
mChainIdx = 1 - mChainIdx;
|
||||
mCameraFrameReady = false;
|
||||
hasFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mStopThread && mCameraFrameReady) {
|
||||
mCameraFrameReady = false;
|
||||
if (!mStopThread && hasFrame) {
|
||||
if (!mFrameChain[1 - mChainIdx].empty())
|
||||
deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<project>
|
||||
<property environment="env"/>
|
||||
<property file="ant-${opencv.build.type}.properties"/>
|
||||
<property name="test.dir" value="testResults"/>
|
||||
<property name="build.dir" value="build"/>
|
||||
|
||||
<path id="master-classpath">
|
||||
<fileset dir="lib">
|
||||
@@ -12,7 +15,7 @@
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
<delete dir="testResults"/>
|
||||
<delete dir="${test.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
@@ -34,10 +37,10 @@
|
||||
</target>
|
||||
|
||||
<target name="test">
|
||||
<mkdir dir="testResults"/>
|
||||
<junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
|
||||
<mkdir dir="${test.dir}"/>
|
||||
<junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="true" logfailedtests="true" maxmemory="256m">
|
||||
<sysproperty key="java.library.path" path="${opencv.lib.path}"/>
|
||||
<env key="PATH" path="${opencv.lib.path}"/>
|
||||
<env key="PATH" path="${opencv.lib.path}:${env.PATH}:${env.Path}"/>
|
||||
<classpath refid="master-classpath"/>
|
||||
<classpath>
|
||||
<pathelement location="build/classes"/>
|
||||
@@ -45,12 +48,18 @@
|
||||
|
||||
<formatter type="xml"/>
|
||||
|
||||
<batchtest fork="yes" todir="testResults">
|
||||
<batchtest fork="yes" todir="${test.dir}">
|
||||
<zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
|
||||
<exclude name="**/*$*.class"/>
|
||||
</zipfileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
<junitreport todir="${test.dir}">
|
||||
<fileset dir="${test.dir}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report format="noframes" todir="${test.dir}"/>
|
||||
</junitreport>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
|
||||
@@ -28,6 +28,11 @@ import org.opencv.features2d.KeyPoint;
|
||||
import org.opencv.highgui.Highgui;
|
||||
|
||||
public class OpenCVTestCase extends TestCase {
|
||||
|
||||
public static class TestSkipException extends RuntimeException {
|
||||
public TestSkipException() {}
|
||||
}
|
||||
|
||||
//change to 'true' to unblock fail on fail("Not yet implemented")
|
||||
public static final boolean passNYI = true;
|
||||
|
||||
@@ -212,12 +217,40 @@ public class OpenCVTestCase extends TestCase {
|
||||
protected void runTest() throws Throwable {
|
||||
// Do nothing if the precondition does not hold.
|
||||
if (isTestCaseEnabled) {
|
||||
super.runTest();
|
||||
try {
|
||||
super.runTest();
|
||||
} catch (TestSkipException ex) {
|
||||
OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" skipped!");
|
||||
assertTrue(true);
|
||||
}
|
||||
} else {
|
||||
OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" disabled!");
|
||||
}
|
||||
}
|
||||
|
||||
public void runBare() throws Throwable {
|
||||
Throwable exception = null;
|
||||
try {
|
||||
setUp();
|
||||
} catch (TestSkipException ex) {
|
||||
OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" skipped!");
|
||||
assertTrue(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
runTest();
|
||||
} catch (Throwable running) {
|
||||
exception = running;
|
||||
} finally {
|
||||
try {
|
||||
tearDown();
|
||||
} catch (Throwable tearingDown) {
|
||||
if (exception == null) exception = tearingDown;
|
||||
}
|
||||
}
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
protected Mat getMat(int type, double... vals)
|
||||
{
|
||||
return new Mat(matSize, matSize, type, new Scalar(vals));
|
||||
@@ -235,6 +268,10 @@ public class OpenCVTestCase extends TestCase {
|
||||
TestCase.fail(msg);
|
||||
}
|
||||
|
||||
public static void assertGE(double v1, double v2) {
|
||||
assertTrue("Failed: " + v1 + " >= " + v2, v1 >= v2);
|
||||
}
|
||||
|
||||
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2) {
|
||||
if (list1.size() != list2.size()) {
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -449,10 +486,10 @@ public class OpenCVTestCase extends TestCase {
|
||||
|
||||
if (isEqualityMeasured)
|
||||
assertTrue("Max difference between expected and actiual Mats is "+ maxDiff + ", that bigger than " + eps,
|
||||
Core.checkRange(diff, true, 0.0, eps));
|
||||
maxDiff <= eps);
|
||||
else
|
||||
assertFalse("Max difference between expected and actiual Mats is "+ maxDiff + ", that less than " + eps,
|
||||
Core.checkRange(diff, true, 0.0, eps));
|
||||
maxDiff <= eps);
|
||||
}
|
||||
|
||||
protected static String readFile(String path) {
|
||||
|
||||
@@ -166,6 +166,7 @@ double showFlowAndCalcError(const string& name, const Mat& gray, const Mat& flow
|
||||
bool all = true;
|
||||
Mat inner = flow(where);
|
||||
for(int y = 0; y < inner.rows; ++y)
|
||||
{
|
||||
for(int x = 0; x < inner.cols; ++x)
|
||||
{
|
||||
const Point2f f = inner.at<Point2f>(y, x);
|
||||
@@ -178,12 +179,14 @@ double showFlowAndCalcError(const string& name, const Mat& gray, const Mat& flow
|
||||
double a = atan2(f.y, f.x);
|
||||
error += fabs(angle - a);
|
||||
}
|
||||
double res = all ? numeric_limits<double>::max() : error / (inner.cols * inner.rows);
|
||||
}
|
||||
|
||||
if (writeError)
|
||||
cout << "Error " + name << " = " << res << endl;
|
||||
double res = all ? numeric_limits<double>::max() : error / (inner.cols * inner.rows);
|
||||
|
||||
return res;
|
||||
if (writeError)
|
||||
cout << "Error " + name << " = " << res << endl;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -461,7 +461,9 @@ void CV_StereoMatchingTest::run(int)
|
||||
int dispScaleFactor = datasetsParams[datasetName].dispScaleFactor;
|
||||
Mat tmp; trueLeftDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueLeftDisp = tmp; tmp.release();
|
||||
if( !trueRightDisp.empty() )
|
||||
{
|
||||
trueRightDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueRightDisp = tmp; tmp.release();
|
||||
}
|
||||
|
||||
Mat leftDisp, rightDisp;
|
||||
int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER);
|
||||
@@ -530,7 +532,7 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
|
||||
// rightDisp is not used in current test virsion
|
||||
int code = cvtest::TS::OK;
|
||||
assert( fs.isOpened() );
|
||||
assert( trueLeftDisp.type() == CV_32FC1 && trueRightDisp.type() == CV_32FC1 );
|
||||
assert( trueLeftDisp.type() == CV_32FC1 && (trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1) );
|
||||
assert( leftDisp.type() == CV_32FC1 && rightDisp.type() == CV_32FC1 );
|
||||
|
||||
// get masks for unknown ground truth disparity values
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@@ -2141,6 +2147,10 @@ CV_EXPORTS bool initModule_ml(void);
|
||||
|
||||
}
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif // __OPENCV_ML_HPP__
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user