aboutsummaryrefslogtreecommitdiff
path: root/graphics/opencv/files
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2018-05-09 01:10:11 +0000
committerSteve Wills <swills@FreeBSD.org>2018-05-09 01:10:11 +0000
commit532105a93cf41f4fe7a4666875c156eabae2ae75 (patch)
tree61c3b03ca83f7ee408d0e57d069b884202696225 /graphics/opencv/files
parent07485881725782b3552ec708bd2ec7ca164f918a (diff)
downloadports-532105a93cf41f4fe7a4666875c156eabae2ae75.tar.gz
ports-532105a93cf41f4fe7a4666875c156eabae2ae75.zip
graphics/opencv: Update to 3.4.1
PR: 210505 Submitted by: rozhuk.im@gmail.com (partially, further work was done) Exp-run by: antoine
Notes
Notes: svn path=/head/; revision=469420
Diffstat (limited to 'graphics/opencv/files')
-rw-r--r--graphics/opencv/files/extra-patch-modules_dnn__modern_CMakeLists.txt37
-rw-r--r--graphics/opencv/files/extra-patch-modules_sfm_CMakeLists.txt40
-rw-r--r--graphics/opencv/files/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h11
-rw-r--r--graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc35
-rw-r--r--graphics/opencv/files/patch-cmake__OpenCVCompilerOptions.cmake27
-rw-r--r--graphics/opencv/files/patch-cmake__OpenCVFindLibsGUI.cmake14
-rw-r--r--graphics/opencv/files/patch-cmake__OpenCVVersion.cmake11
-rw-r--r--graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp10
-rw-r--r--graphics/opencv/files/patch-modules__core__src__system.cpp41
-rw-r--r--graphics/opencv/files/patch-modules__highgui__src__cap_libv4l.cpp19
-rw-r--r--graphics/opencv/files/patch-modules__highgui__src__cap_v4l.cpp19
-rw-r--r--graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp11
-rw-r--r--graphics/opencv/files/patch-modules__ts__src__ts.cpp20
-rw-r--r--graphics/opencv/files/patch-modules_core_include_opencv2_core_cvdef.h20
-rw-r--r--graphics/opencv/files/patch-modules_core_include_opencv2_core_types__c.h49
-rw-r--r--graphics/opencv/files/patch-modules_core_src_utils_filesystem.cpp47
-rw-r--r--graphics/opencv/files/patch-modules_highgui_include_opencv2_highgui_highgui__c.h11
-rw-r--r--graphics/opencv/files/patch-modules_highgui_src_cap__ffmpeg__impl.hpp94
-rw-r--r--graphics/opencv/files/patch-modules_highgui_src_window.cpp11
-rw-r--r--graphics/opencv/files/patch-modules_highgui_src_window__gtk.cpp16
-rw-r--r--graphics/opencv/files/patch-modules_videoio_src_cap__libv4l.cpp76
-rw-r--r--graphics/opencv/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp15
22 files changed, 353 insertions, 281 deletions
diff --git a/graphics/opencv/files/extra-patch-modules_dnn__modern_CMakeLists.txt b/graphics/opencv/files/extra-patch-modules_dnn__modern_CMakeLists.txt
new file mode 100644
index 000000000000..cd478f415543
--- /dev/null
+++ b/graphics/opencv/files/extra-patch-modules_dnn__modern_CMakeLists.txt
@@ -0,0 +1,37 @@
+--- modules/dnn_modern/CMakeLists.txt.orig 2017-12-22 19:15:17.000000000 +0300
++++ modules/dnn_modern/CMakeLists.txt 2018-01-17 02:29:23.382430000 +0300
+@@ -15,20 +15,20 @@
+
+ set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
+ set(TINY_DNN_CPP_ROOT "${TINY_DNN_CPP_PATH}/tiny-dnn-1.0.0a3")
+-ocv_download(FILENAME "v1.0.0a3.tar.gz"
+- HASH "adb1c512e09ca2c7a6faef36f9c53e59"
+- URL
+- "${OPENCV_TINY_DNN_URL}"
+- "$ENV{OPENCV_TINY_DNN_URL}"
+- "https://github.com/tiny-dnn/tiny-dnn/archive/"
+- DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
+- STATUS TINY_DNN_DOWNLOAD_SUCCESS
+- ID "tiny-dnn"
+- UNPACK RELATIVE_URL)
+-
+-if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
+- message(STATUS "Failed to download tiny-dnn sources")
+-endif()
++#ocv_download(FILENAME "v1.0.0a3.tar.gz"
++# HASH "adb1c512e09ca2c7a6faef36f9c53e59"
++# URL
++# "${OPENCV_TINY_DNN_URL}"
++# "$ENV{OPENCV_TINY_DNN_URL}"
++# "https://github.com/tiny-dnn/tiny-dnn/archive/"
++# DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
++# STATUS TINY_DNN_DOWNLOAD_SUCCESS
++# ID "tiny-dnn"
++# UNPACK RELATIVE_URL)
++#
++#if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
++# message(STATUS "Failed to download tiny-dnn sources")
++#endif()
+
+ find_package(TinyDNN QUIET)
+
diff --git a/graphics/opencv/files/extra-patch-modules_sfm_CMakeLists.txt b/graphics/opencv/files/extra-patch-modules_sfm_CMakeLists.txt
new file mode 100644
index 000000000000..c2fa1ba870a5
--- /dev/null
+++ b/graphics/opencv/files/extra-patch-modules_sfm_CMakeLists.txt
@@ -0,0 +1,40 @@
+--- modules/sfm/CMakeLists.txt.orig 2015-12-17 20:11:31.000000000 +0300
++++ modules/sfm/CMakeLists.txt 2016-10-10 18:28:05.556797000 +0300
+@@ -1,25 +1,30 @@
+ set(the_description "SFM algorithms")
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+
+ ### LIBMV LIGHT EXTERNAL DEPENDENCIES ###
+
+ find_package(Gflags QUIET)
+-find_package(Ceres QUIET)
+-if(NOT Ceres_FOUND) # Looks like Ceres find glog on the own, so separate search isn't necessary
++#find_package(Ceres QUIET)
++#if(NOT Ceres_FOUND) # Looks like Ceres find glog on the own, so separate search isn't necessary
+ find_package(Glog QUIET)
+-endif()
++#endif()
+
+ if((gflags_FOUND OR GFLAGS_FOUND) AND (glog_FOUND OR GLOG_FOUND))
+ set(_fname "${CMAKE_CURRENT_BINARY_DIR}/test_sfm_deps.cpp")
+ file(WRITE "${_fname}" "#include <glog/logging.h>\n#include <gflags/gflags.h>\nint main() { (void)(0); return 0; }\n")
+- try_compile(SFM_DEPS_OK "${CMAKE_BINARY_DIR}" "${_fname}"
+- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${GLOG_INCLUDE_DIRS};${GFLAGS_INCLUDE_DIRS}"
+- LINK_LIBRARIES ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}
+- OUTPUT_VARIABLE OUTPUT
++ try_compile(SFM_DEPS_OK "${CMAKE_CURRENT_BINARY_DIR}" "${_fname}"
++ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${GLOG_INCLUDE_DIRS};${GFLAGS_INCLUDE_DIRS} -DLINK_LIBRARIES:STRING=${GLOG_LIBRARIES};${GFLAGS_LIBRARIES}"
+ )
+ file(REMOVE "${_fname}")
+ message(STATUS "Checking SFM deps... ${SFM_DEPS_OK}")
+ else()
++ if(NOT gflags_FOUND AND NOT GFLAGS_FOUND)
++ message(STATUS "gflags not found")
++ endif()
++ if(NOT glog_FOUND AND NOT GLOG_FOUND)
++ message(STATUS "glog not found")
++ endif()
+ set(SFM_DEPS_OK FALSE)
+ endif()
+
diff --git a/graphics/opencv/files/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h b/graphics/opencv/files/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h
new file mode 100644
index 000000000000..6ba8d996322c
--- /dev/null
+++ b/graphics/opencv/files/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h
@@ -0,0 +1,11 @@
+--- modules/sfm/src/libmv_light/libmv/numeric/numeric.h.orig 2017-12-22 19:15:17.000000000 +0300
++++ modules/sfm/src/libmv_light/libmv/numeric/numeric.h 2018-01-15 01:06:23.742535000 +0300
+@@ -35,7 +35,7 @@
+
+ #if !defined(__MINGW64__)
+ # if defined(_WIN32) || defined(__APPLE__) || \
+- defined(__FreeBSD__) || defined(__NetBSD__)
++ defined(__NetBSD__)
+ static void sincos(double x, double *sinx, double *cosx) {
+ *sinx = sin(x);
+ *cosx = cos(x);
diff --git a/graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc b/graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc
new file mode 100644
index 000000000000..6e94e48d9660
--- /dev/null
+++ b/graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc
@@ -0,0 +1,35 @@
+--- modules/sfm/src/libmv_light/libmv/numeric/numeric.cc.orig 2018-04-27 13:11:58.957812000 +0000
++++ modules/sfm/src/libmv_light/libmv/numeric/numeric.cc 2018-04-27 15:52:13.702374000 +0000
+@@ -24,8 +24,8 @@
+ namespace libmv {
+
+ Mat3 RotationAroundX(double angle) {
+- double c, s;
+- sincos(angle, &s, &c);
++ double c = cos(angle);
++ double s = sin(angle);
+ Mat3 R;
+ R << 1, 0, 0,
+ 0, c, -s,
+@@ -34,8 +34,8 @@ Mat3 RotationAroundX(double angle) {
+ }
+
+ Mat3 RotationAroundY(double angle) {
+- double c, s;
+- sincos(angle, &s, &c);
++ double c = cos(angle);
++ double s = sin(angle);
+ Mat3 R;
+ R << c, 0, s,
+ 0, 1, 0,
+@@ -44,8 +44,8 @@ Mat3 RotationAroundY(double angle) {
+ }
+
+ Mat3 RotationAroundZ(double angle) {
+- double c, s;
+- sincos(angle, &s, &c);
++ double c = cos(angle);
++ double s = sin(angle);
+ Mat3 R;
+ R << c, -s, 0,
+ s, c, 0,
diff --git a/graphics/opencv/files/patch-cmake__OpenCVCompilerOptions.cmake b/graphics/opencv/files/patch-cmake__OpenCVCompilerOptions.cmake
deleted file mode 100644
index b6c66a3ae2ec..000000000000
--- a/graphics/opencv/files/patch-cmake__OpenCVCompilerOptions.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
---- ./cmake/OpenCVCompilerOptions.cmake.orig 2013-11-06 09:26:39.000000000 -0500
-+++ ./cmake/OpenCVCompilerOptions.cmake 2013-11-30 05:56:46.000000000 -0500
-@@ -122,7 +122,7 @@
- add_extra_compiler_option(-ffast-math)
- endif()
- if(ENABLE_POWERPC)
-- add_extra_compiler_option("-mcpu=G3 -mtune=G5")
-+ add_extra_compiler_option("-mtune=G5")
- endif()
- if(ENABLE_SSE)
- add_extra_compiler_option(-msse)
-@@ -158,6 +158,7 @@
- endif(NOT MINGW)
-
- if(X86 OR X86_64)
-+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
- if(OPENCV_EXTRA_CXX_FLAGS MATCHES "-m(sse2|avx)")
- add_extra_compiler_option(-mfpmath=sse)# !! important - be on the same wave with x64 compilers
-@@ -165,6 +166,7 @@
- add_extra_compiler_option(-mfpmath=387)
- endif()
- endif()
-+ endif()
- endif()
-
- # Profiling?
diff --git a/graphics/opencv/files/patch-cmake__OpenCVFindLibsGUI.cmake b/graphics/opencv/files/patch-cmake__OpenCVFindLibsGUI.cmake
deleted file mode 100644
index cfe9392d3e21..000000000000
--- a/graphics/opencv/files/patch-cmake__OpenCVFindLibsGUI.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
---- ./cmake/OpenCVFindLibsGUI.cmake.orig 2013-12-10 09:20:59.000000000 -0500
-+++ ./cmake/OpenCVFindLibsGUI.cmake 2013-12-10 09:22:40.000000000 -0500
-@@ -56,10 +56,9 @@
- if(OPENGL_FOUND)
- set(HAVE_OPENGL TRUE)
- list(APPEND OPENCV_LINKER_LIBS ${OPENGL_LIBRARIES})
-+ ocv_include_directories(${OPENGL_INCLUDE_DIR})
- if(QT_QTOPENGL_FOUND)
- set(HAVE_QT_OPENGL TRUE)
-- else()
-- ocv_include_directories(${OPENGL_INCLUDE_DIR})
- endif()
- endif()
- endif()
diff --git a/graphics/opencv/files/patch-cmake__OpenCVVersion.cmake b/graphics/opencv/files/patch-cmake__OpenCVVersion.cmake
deleted file mode 100644
index d77f4b0b5511..000000000000
--- a/graphics/opencv/files/patch-cmake__OpenCVVersion.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./cmake/OpenCVVersion.cmake.orig 2013-10-24 00:12:48.000000000 -0400
-+++ ./cmake/OpenCVVersion.cmake 2013-10-24 00:13:06.000000000 -0400
-@@ -11,7 +11,7 @@
- set(OPENCV_VERSION "${OPENCV_VERSION}.${OPENCV_VERSION_TWEAK}")
- endif()
-
--set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
-+set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}")
- set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
-
- # create a dependency on version file
diff --git a/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp b/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp
deleted file mode 100644
index d44b043812a7..000000000000
--- a/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- ./modules/contrib/src/spinimages.cpp.orig 2013-10-26 07:55:45.000000000 -0400
-+++ ./modules/contrib/src/spinimages.cpp 2013-10-26 07:56:13.000000000 -0400
-@@ -46,6 +46,7 @@
- #include <functional>
- #include <fstream>
- #include <limits>
-+#include <numeric>
- #include <set>
-
- using namespace cv;
diff --git a/graphics/opencv/files/patch-modules__core__src__system.cpp b/graphics/opencv/files/patch-modules__core__src__system.cpp
deleted file mode 100644
index 81eff621346d..000000000000
--- a/graphics/opencv/files/patch-modules__core__src__system.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
---- modules/core/src/system.cpp.orig 2016-09-16 15:55:58 UTC
-+++ modules/core/src/system.cpp
-@@ -157,7 +157,7 @@ std::wstring GetTempFileNameWinRT(std::w
-
- #include <stdarg.h>
-
--#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __QNX__
-+#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __QNX__ || defined __FreeBSD__
- #include <unistd.h>
- #include <stdio.h>
- #include <sys/types.h>
-@@ -942,14 +942,23 @@ struct Mutex::Impl
-
- struct Mutex::Impl
- {
-- Impl() { pthread_mutex_init(&sl, 0); refcount = 1; }
-- ~Impl() { pthread_mutex_destroy(&sl); }
-+ Impl()
-+ {
-+ pthread_mutexattr_t attr;
-+ pthread_mutexattr_init(&attr);
-+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-+ pthread_mutex_init(&mt, &attr);
-+ pthread_mutexattr_destroy(&attr);
-+
-+ refcount = 1;
-+ }
-+ ~Impl() { pthread_mutex_destroy(&mt); }
-
-- void lock() { pthread_mutex_lock(&sl); }
-- bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
-- void unlock() { pthread_mutex_unlock(&sl); }
-+ void lock() { pthread_mutex_lock(&mt); }
-+ bool trylock() { return pthread_mutex_trylock(&mt) == 0; }
-+ void unlock() { pthread_mutex_unlock(&mt); }
-
-- pthread_mutex_t sl;
-+ pthread_mutex_t mt;
- int refcount;
- };
-
diff --git a/graphics/opencv/files/patch-modules__highgui__src__cap_libv4l.cpp b/graphics/opencv/files/patch-modules__highgui__src__cap_libv4l.cpp
deleted file mode 100644
index 33a6ec871e13..000000000000
--- a/graphics/opencv/files/patch-modules__highgui__src__cap_libv4l.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./modules/highgui/src/cap_libv4l.cpp.orig 2013-07-10 07:49:00.000000000 -0400
-+++ ./modules/highgui/src/cap_libv4l.cpp 2013-10-23 23:52:32.000000000 -0400
-@@ -237,7 +237,6 @@
- #include <sys/mman.h>
- #include <string.h>
- #include <stdlib.h>
--#include <asm/types.h> /* for videodev2.h */
- #include <assert.h>
- #include <sys/stat.h>
- #include <sys/ioctl.h>
-@@ -574,7 +573,7 @@
-
- static void v4l2_scan_controls(CvCaptureCAM_V4L* capture) {
-
-- __u32 ctrl_id;
-+ uint32_t ctrl_id;
- struct v4l2_control c;
- if (capture->v4l2_ctrl_ranges != NULL) {
- v4l2_free_ranges(capture);
diff --git a/graphics/opencv/files/patch-modules__highgui__src__cap_v4l.cpp b/graphics/opencv/files/patch-modules__highgui__src__cap_v4l.cpp
deleted file mode 100644
index b8ad1a3fdfa3..000000000000
--- a/graphics/opencv/files/patch-modules__highgui__src__cap_v4l.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./modules/highgui/src/cap_v4l.cpp.orig 2013-10-23 23:54:06.000000000 -0400
-+++ ./modules/highgui/src/cap_v4l.cpp 2013-10-23 23:55:25.000000000 -0400
-@@ -232,7 +232,6 @@
- #include <sys/ioctl.h>
-
- #ifdef HAVE_CAMV4L2
--#include <asm/types.h> /* for videodev2.h */
- #include <linux/videodev2.h>
- #endif
-
-@@ -663,7 +662,7 @@
- static void v4l2_scan_controls(CvCaptureCAM_V4L* capture)
- {
-
-- __u32 ctrl_id;
-+ uint32_t ctrl_id;
-
- for (ctrl_id = V4L2_CID_BASE;
- ctrl_id < V4L2_CID_LASTP1;
diff --git a/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp b/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp
deleted file mode 100644
index 94780cc36351..000000000000
--- a/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./modules/python/src2/cv2.cv.hpp.orig 2013-10-22 17:54:10.000000000 -0400
-+++ ./modules/python/src2/cv2.cv.hpp 2013-10-22 17:55:03.000000000 -0400
-@@ -2169,7 +2169,7 @@
- static int convert_to_CvNextEdgeType(PyObject *o, CvNextEdgeType *dst, const char *name = "no_name")
- {
- if (!PyInt_Check(o)) {
-- *dst = (CvNextEdgeType)NULL;
-+ *dst = (CvNextEdgeType)0;
- return failmsg("Expected number for CvNextEdgeType argument '%s'", name);
- } else {
- *dst = (CvNextEdgeType)PyInt_AsLong(o);
diff --git a/graphics/opencv/files/patch-modules__ts__src__ts.cpp b/graphics/opencv/files/patch-modules__ts__src__ts.cpp
deleted file mode 100644
index 44151a8a0e3d..000000000000
--- a/graphics/opencv/files/patch-modules__ts__src__ts.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- ./modules/ts/src/ts.cpp.orig 2013-10-26 08:01:35.000000000 -0400
-+++ ./modules/ts/src/ts.cpp 2013-10-26 08:02:28.000000000 -0400
-@@ -562,7 +562,7 @@
- for( int i = 0; i < MAX_IDX; i++ )
- if( (streams & (1 << i)) )
- {
-- output_buf[i] += std::string(str);
-+ output_buf[i] += ::std::string(str);
- // in the new GTest-based framework we do not use
- // any output files (except for the automatically generated xml report).
- // if a test fails, all the buffers are printed, so we do not want to duplicate the information and
-@@ -617,7 +617,7 @@
- Scalar s;
- uchar *p = NULL;
- int n = 100/delta;
-- int nR = std::min(n, (img.rows+1)/2), nC = std::min(n, (img.cols+1)/2);
-+ int nR = ::std::min(n, (img.rows+1)/2), nC = std::min(n, (img.cols+1)/2);
-
- int r, c, i;
- for(r=0; r<nR; r++)
diff --git a/graphics/opencv/files/patch-modules_core_include_opencv2_core_cvdef.h b/graphics/opencv/files/patch-modules_core_include_opencv2_core_cvdef.h
new file mode 100644
index 000000000000..0713c9c42675
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_core_include_opencv2_core_cvdef.h
@@ -0,0 +1,20 @@
+--- modules/core/include/opencv2/core/cvdef.h.orig 2018-02-23 08:38:33 UTC
++++ modules/core/include/opencv2/core/cvdef.h
+@@ -452,6 +452,7 @@ Cv64suf;
+ # endif
+ #endif
+
++#if defined __cplusplus
+
+ // Integer types portatibility
+ #ifdef OPENCV_STDINT_HEADER
+@@ -493,6 +494,9 @@ typedef ::int64_t int64_t;
+ typedef ::uint64_t uint64_t;
+ }
+ #endif
++#endif
++#else
++#include <stdint.h>
+ #endif
+
+
diff --git a/graphics/opencv/files/patch-modules_core_include_opencv2_core_types__c.h b/graphics/opencv/files/patch-modules_core_include_opencv2_core_types__c.h
new file mode 100644
index 000000000000..1970421b4437
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_core_include_opencv2_core_types__c.h
@@ -0,0 +1,49 @@
+--- modules/core/include/opencv2/core/types_c.h.orig 2018-02-23 08:38:33 UTC
++++ modules/core/include/opencv2/core/types_c.h
+@@ -63,6 +63,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <float.h>
++#include <math.h>
+ #endif // SKIP_INCLUDES
+
+ #if defined _WIN32
+@@ -196,6 +197,38 @@ enum {
+
+ #define cvInvSqrt(value) ((float)(1./sqrt(value)))
+ #define cvSqrt(value) ((float)sqrt(value))
++
++#ifndef __cplusplus
++CV_INLINE int cvRound(float value)
++{
++#if ((defined _MSC_VER && defined _M_X64) || ((defined __GNUC__ || defined __clang__) && defined __x86_64__ && \
++ defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
++ __m128 t = _mm_set_ss( value );
++ return _mm_cvtss_si32(t);
++#elif defined _MSC_VER && defined _M_IX86
++ int t;
++ __asm
++ {
++ fld value;
++ fistp t;
++ }
++ return t;
++#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
++ defined __GNUC__ || defined __clang__) && defined HAVE_TEGRA_OPTIMIZATION
++ TEGRA_ROUND_FLT(value);
++#elif defined CV_ICC || defined __GNUC__ || defined __clang__
++# if CV_VFP
++ ARM_ROUND_FLT(value);
++# else
++ return (int)lrintf(value);
++# endif
++#else
++ /* it's ok if round does not comply with IEEE754 standard;
++ the tests should allow +/-1 difference when the tested functions use round */
++ return (int)(value + (value >= 0 ? 0.5f : -0.5f));
++#endif
++}
++#endif
+
+
+ /*************** Random number generation *******************/
diff --git a/graphics/opencv/files/patch-modules_core_src_utils_filesystem.cpp b/graphics/opencv/files/patch-modules_core_src_utils_filesystem.cpp
new file mode 100644
index 000000000000..a835bdf8abc7
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_core_src_utils_filesystem.cpp
@@ -0,0 +1,47 @@
+--- modules/core/src/utils/filesystem.cpp.orig 2017-12-22 22:46:21.000000000 +0300
++++ modules/core/src/utils/filesystem.cpp 2018-01-14 12:05:05.454427000 +0300
+@@ -33,7 +33,7 @@
+ #include <errno.h>
+ #include <io.h>
+ #include <stdio.h>
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __linux__ || defined __APPLE__ || defined(__FreeBSD__)
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+@@ -156,7 +156,7 @@
+ sz = GetCurrentDirectoryA((DWORD)buf.size(), (char*)buf);
+ return cv::String((char*)buf, (size_t)sz);
+ #endif
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __linux__ || defined __APPLE__ || defined(__FreeBSD__)
+ for(;;)
+ {
+ char* p = ::getcwd((char*)buf, buf.size());
+@@ -190,7 +190,7 @@
+ #else
+ int result = _mkdir(path.c_str());
+ #endif
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __linux__ || defined __APPLE__ || defined(__FreeBSD__)
+ int result = mkdir(path.c_str(), 0777);
+ #else
+ int result = -1;
+@@ -305,7 +305,7 @@
+ Impl& operator=(const Impl&); // disabled
+ };
+
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __linux__ || defined __APPLE__ || defined(__FreeBSD__)
+
+ struct FileLock::Impl
+ {
+@@ -408,7 +408,7 @@
+ }
+ #elif defined __ANDROID__
+ // no defaults
+-#elif defined __APPLE__
++#elif defined __APPLE__ || defined(__FreeBSD__)
+ const char* tmpdir_env = getenv("TMPDIR");
+ if (tmpdir_env && utils::fs::isDirectory(tmpdir_env))
+ {
diff --git a/graphics/opencv/files/patch-modules_highgui_include_opencv2_highgui_highgui__c.h b/graphics/opencv/files/patch-modules_highgui_include_opencv2_highgui_highgui__c.h
new file mode 100644
index 000000000000..026268502290
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_highgui_include_opencv2_highgui_highgui__c.h
@@ -0,0 +1,11 @@
+--- ./modules/highgui/include/opencv2/highgui/highgui_c.h.orig 2018-05-02 14:30:32.736476000 -0400
++++ ./modules/highgui/include/opencv2/highgui/highgui_c.h 2018-05-02 14:33:46.169249000 -0400
+@@ -136,7 +136,7 @@ CVAPI(void) cvSetWindowProperty(const char* name, int
+ CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
+
+ /* Get window image rectangle coordinates, width and height */
+-CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
++CVAPI(CvRect)cvGetWindowImageRect(const char* name);
+
+ /* display image within window (highgui windows remember their content) */
+ CVAPI(void) cvShowImage( const char* name, const CvArr* image );
diff --git a/graphics/opencv/files/patch-modules_highgui_src_cap__ffmpeg__impl.hpp b/graphics/opencv/files/patch-modules_highgui_src_cap__ffmpeg__impl.hpp
deleted file mode 100644
index a8f6abd38dbc..000000000000
--- a/graphics/opencv/files/patch-modules_highgui_src_cap__ffmpeg__impl.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-https://github.com/opencv/opencv/commit/99091a62463e
-
---- modules/highgui/src/cap_ffmpeg_impl.hpp.orig 2016-09-16 15:55:58 UTC
-+++ modules/highgui/src/cap_ffmpeg_impl.hpp
-@@ -170,6 +170,10 @@ extern "C" {
- #define AV_PIX_FMT_GRAY16BE PIX_FMT_GRAY16BE
- #endif
-
-+#ifndef PKT_FLAG_KEY
-+#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
-+#endif
-+
- #if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \
- ? CALC_FFMPEG_VERSION(52, 38, 100) : CALC_FFMPEG_VERSION(52, 13, 0))
- #define USE_AV_FRAME_GET_BUFFER 1
-@@ -1478,7 +1482,11 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatC
- // some formats want stream headers to be seperate
- if(oc->oformat->flags & AVFMT_GLOBALHEADER)
- {
-+#if LIBAVCODEC_BUILD > CALC_FFMPEG_VERSION(56, 35, 0)
-+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
-+#else
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-+#endif
- }
- #endif
-
-@@ -1502,23 +1510,24 @@ static int icv_av_write_frame_FFMPEG( AVFormatContext
- #endif
- int ret = OPENCV_NO_FRAMES_WRITTEN_CODE;
-
-- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
-+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
-+ if (oc->oformat->flags & AVFMT_RAWPICTURE)
-+ {
- /* raw video case. The API will change slightly in the near
- futur for that */
- AVPacket pkt;
- av_init_packet(&pkt);
-
--#ifndef PKT_FLAG_KEY
--#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
--#endif
--
- pkt.flags |= PKT_FLAG_KEY;
- pkt.stream_index= video_st->index;
- pkt.data= (uint8_t *)picture;
- pkt.size= sizeof(AVPicture);
-
- ret = av_write_frame(oc, &pkt);
-- } else {
-+ }
-+ else
-+#endif
-+ {
- /* encode the image */
- AVPacket pkt;
- av_init_packet(&pkt);
-@@ -1676,7 +1685,9 @@ void CvVideoWriter_FFMPEG::close()
- /* write the trailer, if any */
- if(ok && oc)
- {
-- if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
-+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
-+ if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
-+#endif
- {
- for(;;)
- {
-@@ -1910,7 +1921,10 @@ bool CvVideoWriter_FFMPEG::open( const char * filename
-
- outbuf = NULL;
-
-- if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
-+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
-+ if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
-+#endif
-+ {
- /* allocate output buffer */
- /* assume we will never get codec output with more than 4 bytes per pixel... */
- outbuf_size = width*height*4;
-@@ -2204,7 +2218,11 @@ AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVF
- // some formats want stream headers to be seperate
- if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- {
-- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-+ #if LIBAVCODEC_BUILD > CALC_FFMPEG_VERSION(56, 35, 0)
-+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
-+ #else
-+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-+ #endif
- }
- #endif
-
diff --git a/graphics/opencv/files/patch-modules_highgui_src_window.cpp b/graphics/opencv/files/patch-modules_highgui_src_window.cpp
new file mode 100644
index 000000000000..241840e3edb0
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_highgui_src_window.cpp
@@ -0,0 +1,11 @@
+--- ./modules/highgui/src/window.cpp.orig 2018-05-02 14:34:06.721814000 -0400
++++ ./modules/highgui/src/window.cpp 2018-05-02 14:34:25.980873000 -0400
+@@ -165,7 +165,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, i
+ }
+ }
+
+-cv::Rect cvGetWindowImageRect(const char* name)
++CvRect cvGetWindowImageRect(const char* name)
+ {
+ if (!name)
+ return cv::Rect(-1, -1, -1, -1);
diff --git a/graphics/opencv/files/patch-modules_highgui_src_window__gtk.cpp b/graphics/opencv/files/patch-modules_highgui_src_window__gtk.cpp
new file mode 100644
index 000000000000..114c824b815a
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_highgui_src_window__gtk.cpp
@@ -0,0 +1,16 @@
+--- modules/highgui/src/window_gtk.cpp.orig 2016-12-23 12:54:44 UTC
++++ modules/highgui/src/window_gtk.cpp
+@@ -46,10 +46,12 @@
+
+ #if defined (HAVE_GTK)
+
++#include <stdio.h>
++#include <stdlib.h>
+ #include <gtk/gtk.h>
++#include <gdk/gdk.h>
+ #include <gdk/gdkkeysyms.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
+-#include <stdio.h>
+
+ #if (GTK_MAJOR_VERSION == 3)
+ #define GTK_VERSION3 1
diff --git a/graphics/opencv/files/patch-modules_videoio_src_cap__libv4l.cpp b/graphics/opencv/files/patch-modules_videoio_src_cap__libv4l.cpp
new file mode 100644
index 000000000000..4744276df79c
--- /dev/null
+++ b/graphics/opencv/files/patch-modules_videoio_src_cap__libv4l.cpp
@@ -0,0 +1,76 @@
+--- modules/videoio/src/cap_libv4l.cpp.orig 2016-12-23 12:54:44 UTC
++++ modules/videoio/src/cap_libv4l.cpp
+@@ -251,7 +251,9 @@ make & enjoy!
+ #include <sys/mman.h>
+ #include <string.h>
+ #include <stdlib.h>
++#ifdef __linux__
+ #include <asm/types.h> /* for videodev2.h */
++#endif
+ #include <assert.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+@@ -298,12 +300,12 @@ static unsigned int n_buffers = 0;
+ /* TODO: Consider at program exit return controls to the initial values - See v4l2_free_ranges function */
+ /* TODO: Consider at program exit reset the device to default values - See v4l2_free_ranges function */
+ typedef struct v4l2_ctrl_range {
+- __u32 ctrl_id;
+- __s32 initial_value;
+- __s32 current_value;
+- __s32 minimum;
+- __s32 maximum;
+- __s32 default_value;
++ uint32_t ctrl_id;
++ int32_t initial_value;
++ int32_t current_value;
++ int32_t minimum;
++ int32_t maximum;
++ int32_t default_value;
+ } v4l2_ctrl_range;
+
+ typedef struct CvCaptureCAM_V4L
+@@ -542,7 +544,7 @@ static void v4l2_add_ctrl_range(CvCaptur
+ capture->v4l2_ctrl_ranges = (v4l2_ctrl_range**)realloc((v4l2_ctrl_range**)capture->v4l2_ctrl_ranges, (capture->v4l2_ctrl_count + 1) * sizeof(v4l2_ctrl_range*));
+ }
+
+-static int v4l2_get_ctrl_default(CvCaptureCAM_V4L* capture, __u32 id) {
++static int v4l2_get_ctrl_default(CvCaptureCAM_V4L* capture, uint32_t id) {
+ int i;
+ for (i = 0; i < capture->v4l2_ctrl_count; i++) {
+ if (id == capture->v4l2_ctrl_ranges[i]->ctrl_id) {
+@@ -552,7 +554,7 @@ static int v4l2_get_ctrl_default(CvCaptu
+ return -1;
+ }
+
+-static int v4l2_get_ctrl_min(CvCaptureCAM_V4L* capture, __u32 id) {
++static int v4l2_get_ctrl_min(CvCaptureCAM_V4L* capture, uint32_t id) {
+ int i;
+ for (i = 0; i < capture->v4l2_ctrl_count; i++) {
+ if (id == capture->v4l2_ctrl_ranges[i]->ctrl_id) {
+@@ -562,7 +564,7 @@ static int v4l2_get_ctrl_min(CvCaptureCA
+ return -1;
+ }
+
+-static int v4l2_get_ctrl_max(CvCaptureCAM_V4L* capture, __u32 id) {
++static int v4l2_get_ctrl_max(CvCaptureCAM_V4L* capture, uint32_t id) {
+ int i;
+ for (i = 0; i < capture->v4l2_ctrl_count; i++) {
+ if (id == capture->v4l2_ctrl_ranges[i]->ctrl_id) {
+@@ -575,7 +577,7 @@ static int v4l2_get_ctrl_max(CvCaptureCA
+
+ static void v4l2_scan_controls(CvCaptureCAM_V4L* capture) {
+
+- __u32 ctrl_id;
++ uint32_t ctrl_id;
+ struct v4l2_control c;
+ if (capture->v4l2_ctrl_ranges != NULL) {
+ v4l2_free_ranges(capture);
+@@ -1653,7 +1655,7 @@ static int icvSetVideoSize( CvCaptureCAM
+
+ static int icvSetControl (CvCaptureCAM_V4L* capture, int property_id, double value) {
+ struct v4l2_control c;
+- __s32 ctrl_value;
++ int32_t ctrl_value;
+ char name[32];
+ int is_v4l2 = 1;
+ int v4l2_min = 0;
diff --git a/graphics/opencv/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp b/graphics/opencv/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp
deleted file mode 100644
index 8c0e72703f52..000000000000
--- a/graphics/opencv/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
---- ./samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp.orig 2013-10-26 09:51:39.000000000 -0400
-+++ ./samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp 2013-10-26 09:51:47.000000000 -0400
-@@ -1,4 +1,4 @@
--#include <opencv2/core/core.hpp>
-+#include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <iostream>
- #include <sstream>
-@@ -213,4 +213,4 @@
- }
-
- return I;
--}
-\ No newline at end of file
-+}