From c909693d45423b12346b6ca590b5dcbb21ae28d3 Mon Sep 17 00:00:00 2001 From: Qoo Date: Fri, 12 Feb 2021 19:12:05 -0500 Subject: [PATCH 01/17] refine --- modules/dnn/src/layers/proposal_layer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dnn/src/layers/proposal_layer.cpp b/modules/dnn/src/layers/proposal_layer.cpp index 990cfeda30..403ec826d3 100644 --- a/modules/dnn/src/layers/proposal_layer.cpp +++ b/modules/dnn/src/layers/proposal_layer.cpp @@ -54,11 +54,11 @@ public: for (int i = 0; i < ratios.size(); ++i) { float ratio = ratios.get(i); + float width = std::floor(baseSize / sqrt(ratio) + 0.5f); + float height = std::floor(width * ratio + 0.5f); for (int j = 0; j < scales.size(); ++j) { float scale = scales.get(j); - float width = std::floor(baseSize / sqrt(ratio) + 0.5f); - float height = std::floor(width * ratio + 0.5f); widths.push_back(scale * width); heights.push_back(scale * height); } From d2d6eba16a8ff2057384abd2c0ff70ac6862513a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sat, 13 Feb 2021 00:35:18 +0000 Subject: [PATCH 02/17] cmake: fix add_apple_compiler_options() calls and OBJCXX handling --- cmake/OpenCVUtils.cmake | 10 ++++++++-- modules/highgui/CMakeLists.txt | 2 +- modules/imgcodecs/CMakeLists.txt | 2 +- modules/videoio/CMakeLists.txt | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 735fa10a4c..d03dc9c551 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -564,7 +564,11 @@ macro(ocv_check_flag_support lang flag varname base_options) elseif("_${lang}_" MATCHES "_C_") set(_lang C) elseif("_${lang}_" MATCHES "_OBJCXX_") - set(_lang OBJCXX) + if(DEFINED CMAKE_OBJCXX_COMPILER) # CMake 3.16+ and enable_language(OBJCXX) call are required + set(_lang OBJCXX) + else() + set(_lang CXX) + endif() else() set(_lang ${lang}) endif() @@ -573,7 +577,9 @@ macro(ocv_check_flag_support lang flag varname base_options) string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}") string(REGEX REPLACE " -|-|=| |\\.|," "_" ${varname} "${${varname}}") - ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN}) + if(DEFINED CMAKE_${_lang}_COMPILER) + ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN}) + endif() endmacro() macro(ocv_check_runtime_flag flag result) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index bd7c8980be..296f4cab2b 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -151,7 +151,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES}) macro(ocv_highgui_configure_target) if(APPLE) - add_apple_compiler_options(the_module) + add_apple_compiler_options(${the_module}) endif() if(MSVC) diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt index 1b832eaa3a..2498b5ae83 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt @@ -131,7 +131,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES}) macro(ocv_imgcodecs_configure_target) if(APPLE) - add_apple_compiler_options(the_module) + add_apple_compiler_options(${the_module}) endif() if(MSVC) diff --git a/modules/videoio/CMakeLists.txt b/modules/videoio/CMakeLists.txt index 3dac3e816c..cc0c5eb1c5 100644 --- a/modules/videoio/CMakeLists.txt +++ b/modules/videoio/CMakeLists.txt @@ -253,7 +253,7 @@ ocv_create_module(${VIDEOIO_LIBRARIES}) macro(ocv_videoio_configure_target) if(APPLE) - add_apple_compiler_options(the_module) + add_apple_compiler_options(${the_module}) endif() if(MSVC) From 743099f9f9603e6b06b236c64a06011861907a2a Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Mon, 15 Feb 2021 02:37:11 +0800 Subject: [PATCH 03/17] Merge pull request #19521 from zchrissirhcz:3.4-fix-core-module-android-arm64-build * fix core module android arm64 build * fix core module android build when neon is off When building for Android ARM platform, cmake with `-D CV_DISABLE_OPTIMIZATION=ON`, the expected behavior is not using ARM NEON, using naive computation instead. This commit fix the un-expected compile error for neon intrinsincs. --- modules/core/src/rand.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index 539f92aeb1..8c66cdcc07 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -243,7 +243,7 @@ static void randf_32f( float* arr, int len, uint64* state, const Vec2f* p, bool __m128 p1 = _mm_unpackhi_ps(q01l, q01h); _mm_storeu_ps(arr + i, _mm_add_ps(_mm_mul_ps(_mm_loadu_ps(f), p0), p1)); -#elif defined __ARM_NEON && defined __aarch64__ +#elif CV_NEON && defined __aarch64__ // handwritten NEON is required not for performance but for numerical stability! // 64bit gcc tends to use fmadd instead of separate multiply and add // use volatile to ensure to separate the multiply and add @@ -278,7 +278,7 @@ static void randf_32f( float* arr, int len, uint64* state, const Vec2f* p, bool _mm_mul_ss(_mm_set_ss((float)(int)temp), _mm_set_ss(p[i][0])), _mm_set_ss(p[i][1])) ); -#elif defined __ARM_NEON && defined __aarch64__ +#elif CV_NEON && defined __aarch64__ float32x2_t t = vadd_f32(vmul_f32( vdup_n_f32((float)(int)temp), vdup_n_f32(p[i][0])), vdup_n_f32(p[i][1])); From a5a421a9f16763731255d9cd0d41b6d33db17f6d Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Mon, 15 Feb 2021 02:38:53 +0800 Subject: [PATCH 04/17] Merge pull request #19522 from zchrissirhcz:3.4-fix-android-find-zlib-shared-since-ndk19 * fix find zlib.so instead of zlib.a when NDK >= 19 On Android platform, `libopencv_imgcodecs.a` is built, expected to depend on `libz.so`. However, since Android NDK r19, NDK's `libz.a` is found instead of `libz.so`, leading to link error (not found libz.a) on machines without same NDK version & direcotry. Since Android NDK-r19, toolchain pieces are installed to `$NDK/toolchains/llvm/prebuilt//...`, including `libz.so`. Also installed to old paths (`/platforms` and `/sysroot`) in NDK r19, r20, r21, but since NDK 22, old paths are removed. - https://github.com/android/ndk/wiki/Changelog-r19 - https://github.com/android/ndk/wiki/Changelog-r22 With this commit, `libz.so` can be correctly found in NDK<19 and NDK>=19. `ZLIB_LIBRARIES` is also simplified as `z`, by appending match (regex) patterns for new toolchain installation directory's libz.so's paths. * simplify libz.so match pattern for abbreviation --- cmake/OpenCVFindLibsGrfmt.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index f99bb33c80..2d28dff875 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -7,9 +7,17 @@ if(BUILD_ZLIB) ocv_clear_vars(ZLIB_FOUND) else() ocv_clear_internal_cache_vars(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) + if(ANDROID) + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES .so) + endif() find_package(ZLIB "${MIN_VER_ZLIB}") + if(ANDROID) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) + endif() if(ZLIB_FOUND AND ANDROID) - if(ZLIB_LIBRARIES MATCHES "/usr/(lib|lib32|lib64)/libz.so$") + if(ZLIB_LIBRARIES MATCHES "/usr/lib.*/libz.so$") set(ZLIB_LIBRARIES z) endif() endif() From 5d1540f4fc1ba1736cb248561ad1915abdef7246 Mon Sep 17 00:00:00 2001 From: Tomoaki Teshima Date: Mon, 15 Feb 2021 21:01:41 +0900 Subject: [PATCH 05/17] remove danger race condition --- modules/cudafilters/src/cuda/median_filter.cu | 89 ++++++++----------- 1 file changed, 38 insertions(+), 51 deletions(-) diff --git a/modules/cudafilters/src/cuda/median_filter.cu b/modules/cudafilters/src/cuda/median_filter.cu index cbc53f4b4f..dd43a365c0 100644 --- a/modules/cudafilters/src/cuda/median_filter.cu +++ b/modules/cudafilters/src/cuda/median_filter.cu @@ -50,9 +50,6 @@ namespace cv { namespace cuda { namespace device { - // // namespace imgproc - // { - __device__ void histogramAddAndSub8(int* H, const int * hist_colAdd,const int * hist_colSub){ int tx = threadIdx.x; if (tx<8){ @@ -120,6 +117,25 @@ namespace cv { namespace cuda { namespace device luc[tx]=0; } +#define scanNeighbor(array, range, index, threadIndex) \ + { \ + int v = 0; \ + if (index <= threadIndex && threadIndex < range) \ + v = array[threadIndex] + array[threadIndex-index]; \ + __syncthreads(); \ + if (index <= threadIndex && threadIndex < range) \ + array[threadIndex] = v; \ + } +#define findMedian(array, range, threadIndex, result, count, position) \ + if (threadIndex < range) \ + { \ + if (array[threadIndex+1] > position && array[threadIndex] <= position) \ + { \ + *result = threadIndex+1; \ + *count = array[threadIndex]; \ + } \ + } + __device__ void histogramMedianPar8LookupOnly(int* H,int* Hscan, const int medPos,int* retval, int* countAtMed){ int tx=threadIdx.x; *retval=*countAtMed=0; @@ -127,28 +143,14 @@ namespace cv { namespace cuda { namespace device Hscan[tx]=H[tx]; } __syncthreads(); - if (1 <= tx && tx < 8 ) - Hscan[tx]+=Hscan[tx-1]; + scanNeighbor(Hscan, 8, 1, tx); __syncthreads(); - if (2 <= tx && tx < 8 ) - Hscan[tx]+=Hscan[tx-2]; + scanNeighbor(Hscan, 8, 2, tx); __syncthreads(); - if (4 <= tx && tx < 8 ) - Hscan[tx]+=Hscan[tx-4]; + scanNeighbor(Hscan, 8, 4, tx); __syncthreads(); - if(tx<7){ - if(Hscan[tx+1] > medPos && Hscan[tx] < medPos){ - *retval=tx+1; - *countAtMed=Hscan[tx]; - } - else if(Hscan[tx]==medPos){ - if(Hscan[tx+1]>medPos){ - *retval=tx+1; - *countAtMed=Hscan[tx]; - } - } - } + findMedian(Hscan, 7, tx, retval, countAtMed, medPos); } __device__ void histogramMedianPar32LookupOnly(int* H,int* Hscan, const int medPos,int* retval, int* countAtMed){ @@ -158,33 +160,18 @@ namespace cv { namespace cuda { namespace device Hscan[tx]=H[tx]; } __syncthreads(); - if ( 1 <= tx && tx < 32 ) - Hscan[tx]+=Hscan[tx-1]; + scanNeighbor(Hscan, 32, 1, tx); __syncthreads(); - if ( 2 <= tx && tx < 32 ) - Hscan[tx]+=Hscan[tx-2]; + scanNeighbor(Hscan, 32, 2, tx); __syncthreads(); - if ( 4 <= tx && tx < 32 ) - Hscan[tx]+=Hscan[tx-4]; + scanNeighbor(Hscan, 32, 4, tx); __syncthreads(); - if ( 8 <= tx && tx < 32 ) - Hscan[tx]+=Hscan[tx-8]; + scanNeighbor(Hscan, 32, 8, tx); __syncthreads(); - if ( 16 <= tx && tx < 32 ) - Hscan[tx]+=Hscan[tx-16]; + scanNeighbor(Hscan, 32, 16, tx); __syncthreads(); - if(tx<31){ - if(Hscan[tx+1] > medPos && Hscan[tx] < medPos){ - *retval=tx+1; - *countAtMed=Hscan[tx]; - } - else if(Hscan[tx]==medPos){ - if(Hscan[tx+1]>medPos){ - *retval=tx+1; - *countAtMed=Hscan[tx]; - } - } - } + + findMedian(Hscan, 31, tx, retval, countAtMed, medPos); } __global__ void cuMedianFilterMultiBlock(PtrStepSzb src, PtrStepSzb dest, PtrStepSzi histPar, PtrStepSzi coarseHistGrid,int r, int medPos_) @@ -283,7 +270,6 @@ namespace cv { namespace cuda { namespace device __syncthreads(); histogramMultipleAdd8(HCoarse,histCoarse, 2*r+1); -// __syncthreads(); int cols_m_1=cols-1; for(int j=r;j=0){ From cbb230fdfc0223a33cf2629963fe0253b91ca3eb Mon Sep 17 00:00:00 2001 From: "amir.tulegenov" Date: Mon, 15 Feb 2021 15:19:23 +0600 Subject: [PATCH 06/17] fix getDefaultName() --- modules/cudaoptflow/src/brox.cpp | 2 ++ modules/cudaoptflow/src/farneback.cpp | 2 ++ modules/cudaoptflow/src/pyrlk.cpp | 4 ++++ modules/cudaoptflow/src/tvl1flow.cpp | 3 +++ modules/video/src/lkpyramid.cpp | 2 ++ modules/video/src/optflowgf.cpp | 2 ++ modules/video/src/tvl1flow.cpp | 2 ++ 7 files changed, 17 insertions(+) diff --git a/modules/cudaoptflow/src/brox.cpp b/modules/cudaoptflow/src/brox.cpp index 11c541906b..70c8a4e0bd 100644 --- a/modules/cudaoptflow/src/brox.cpp +++ b/modules/cudaoptflow/src/brox.cpp @@ -64,6 +64,8 @@ namespace { { } + virtual String getDefaultName() const { return "DenseOpticalFlow.BroxOpticalFlow"; } + virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow, Stream& stream); virtual double getFlowSmoothness() const { return alpha_; } diff --git a/modules/cudaoptflow/src/farneback.cpp b/modules/cudaoptflow/src/farneback.cpp index 69ea437ec4..7cc8373f72 100644 --- a/modules/cudaoptflow/src/farneback.cpp +++ b/modules/cudaoptflow/src/farneback.cpp @@ -129,6 +129,8 @@ namespace virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow, Stream& stream); + virtual String getDefaultName() const { return "DenseOpticalFlow.FarnebackOpticalFlow"; } + private: int numLevels_; double pyrScale_; diff --git a/modules/cudaoptflow/src/pyrlk.cpp b/modules/cudaoptflow/src/pyrlk.cpp index 1020977903..d7447ae71b 100644 --- a/modules/cudaoptflow/src/pyrlk.cpp +++ b/modules/cudaoptflow/src/pyrlk.cpp @@ -347,6 +347,8 @@ namespace sparse(prevImg, nextImg, prevPts, nextPts, status, err, stream); } } + + virtual String getDefaultName() const { return "SparseOpticalFlow.SparsePyrLKOpticalFlow"; } }; class DensePyrLKOpticalFlowImpl : public DensePyrLKOpticalFlow, private PyrLKOpticalFlowBase @@ -388,6 +390,8 @@ namespace GpuMat flows[] = {u, v}; cuda::merge(flows, 2, _flow, stream); } + + virtual String getDefaultName() const { return "DenseOpticalFlow.DensePyrLKOpticalFlow"; } }; } diff --git a/modules/cudaoptflow/src/tvl1flow.cpp b/modules/cudaoptflow/src/tvl1flow.cpp index abc6c2e318..5f28d4c617 100644 --- a/modules/cudaoptflow/src/tvl1flow.cpp +++ b/modules/cudaoptflow/src/tvl1flow.cpp @@ -119,6 +119,9 @@ namespace virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow, Stream& stream); + virtual String getDefaultName() const { return "DenseOpticalFlow.OpticalFlowDual_TVL1"; } + + private: double tau_; double lambda_; diff --git a/modules/video/src/lkpyramid.cpp b/modules/video/src/lkpyramid.cpp index f441be80f4..8df531448a 100644 --- a/modules/video/src/lkpyramid.cpp +++ b/modules/video/src/lkpyramid.cpp @@ -867,6 +867,8 @@ namespace OutputArray status, OutputArray err = cv::noArray()) CV_OVERRIDE; + virtual String getDefaultName() const CV_OVERRIDE { return "SparseOpticalFlow.SparsePyrLKOpticalFlow"; } + private: #ifdef HAVE_OPENCL bool checkParam() diff --git a/modules/video/src/optflowgf.cpp b/modules/video/src/optflowgf.cpp index 83ad47fc0e..2b164b62d3 100644 --- a/modules/video/src/optflowgf.cpp +++ b/modules/video/src/optflowgf.cpp @@ -618,6 +618,8 @@ public: virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + virtual String getDefaultName() const CV_OVERRIDE { return "DenseOpticalFlow.FarnebackOpticalFlow"; } + private: int numLevels_; double pyrScale_; diff --git a/modules/video/src/tvl1flow.cpp b/modules/video/src/tvl1flow.cpp index dc2dc827ac..607c0cf7e0 100644 --- a/modules/video/src/tvl1flow.cpp +++ b/modules/video/src/tvl1flow.cpp @@ -102,6 +102,8 @@ public: } OpticalFlowDual_TVL1(); + virtual String getDefaultName() const CV_OVERRIDE { return "DenseOpticalFlow.DualTVL1OpticalFlow"; } + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; void collectGarbage() CV_OVERRIDE; From f0445295bd4414a548462d7aed735985c12415b1 Mon Sep 17 00:00:00 2001 From: Dan Ben-Yosef Date: Mon, 15 Feb 2021 21:58:37 +0200 Subject: [PATCH 07/17] Merge pull request #19525 from danbey:Fix-cppcheck-error-in-carotete-lib * Reduce if statement as it has the same expression on both sides of '&&' If statement has the same expression on both sides so this can be reduce Signed-off-by: Dan Ben Yosef * The if statement is to check width and height --- 3rdparty/carotene/src/resize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/carotene/src/resize.cpp b/3rdparty/carotene/src/resize.cpp index 49205573cd..aa5b756c75 100644 --- a/3rdparty/carotene/src/resize.cpp +++ b/3rdparty/carotene/src/resize.cpp @@ -758,7 +758,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize, } else if (channels == 3) { - if ((wr == 2.0f) && (wr == 2.0f)) + if ((wr == 2.0f) && (hr == 2.0f)) { #ifndef __ANDROID__ size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0; From 6d3502833f85f0ea97817942498fe662abdf7175 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 16 Feb 2021 10:06:31 +0000 Subject: [PATCH 08/17] core: include version.hpp in cvdef.h, fix precomp.hpp usage --- modules/core/include/opencv2/core.hpp | 1 - modules/core/include/opencv2/core/cvdef.h | 2 ++ modules/core/include/opencv2/core/simd_intrinsics.hpp | 1 - modules/core/src/hal_internal.cpp | 1 + modules/core/src/hal_internal.hpp | 2 -- modules/core/src/intel_gpu_gemm.inl.hpp | 1 - modules/core/src/matrix_c.cpp | 6 +++++- modules/core/src/matrix_iterator.cpp | 3 +-- modules/core/src/matrix_operations.cpp | 3 +-- modules/core/src/matrix_sparse.cpp | 3 +-- modules/core/src/matrix_wrap.cpp | 3 +-- 11 files changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index fc2432dcdf..be0a3a0dc5 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -50,7 +50,6 @@ #endif #include "opencv2/core/cvdef.h" -#include "opencv2/core/version.hpp" #include "opencv2/core/base.hpp" #include "opencv2/core/cvstd.hpp" #include "opencv2/core/traits.hpp" diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index 6488b8bd4f..38f9eed452 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -45,6 +45,8 @@ #ifndef OPENCV_CORE_CVDEF_H #define OPENCV_CORE_CVDEF_H +#include "opencv2/core/version.hpp" + //! @addtogroup core_utils //! @{ diff --git a/modules/core/include/opencv2/core/simd_intrinsics.hpp b/modules/core/include/opencv2/core/simd_intrinsics.hpp index 7151d36073..309202d123 100644 --- a/modules/core/include/opencv2/core/simd_intrinsics.hpp +++ b/modules/core/include/opencv2/core/simd_intrinsics.hpp @@ -40,7 +40,6 @@ Notes: #endif #include "opencv2/core/cvdef.h" -#include "opencv2/core/version.hpp" #ifdef OPENCV_SIMD_CONFIG_HEADER #include CVAUX_STR(OPENCV_SIMD_CONFIG_HEADER) diff --git a/modules/core/src/hal_internal.cpp b/modules/core/src/hal_internal.cpp index 60f96c0164..483281d1f7 100644 --- a/modules/core/src/hal_internal.cpp +++ b/modules/core/src/hal_internal.cpp @@ -42,6 +42,7 @@ // //M*/ +#include "precomp.hpp" #include "hal_internal.hpp" #ifdef HAVE_LAPACK diff --git a/modules/core/src/hal_internal.hpp b/modules/core/src/hal_internal.hpp index 129a710145..c7a0d46de4 100644 --- a/modules/core/src/hal_internal.hpp +++ b/modules/core/src/hal_internal.hpp @@ -45,8 +45,6 @@ #ifndef OPENCV_CORE_HAL_INTERNAL_HPP #define OPENCV_CORE_HAL_INTERNAL_HPP -#include "precomp.hpp" - #ifdef HAVE_LAPACK int lapack_LU32f(float* a, size_t a_step, int m, float* b, size_t b_step, int n, int* info); diff --git a/modules/core/src/intel_gpu_gemm.inl.hpp b/modules/core/src/intel_gpu_gemm.inl.hpp index 729b43f604..fbd567b949 100644 --- a/modules/core/src/intel_gpu_gemm.inl.hpp +++ b/modules/core/src/intel_gpu_gemm.inl.hpp @@ -25,7 +25,6 @@ #ifdef HAVE_OPENCL #include -#include "precomp.hpp" #include "opencl_kernels_core.hpp" #include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp" #include "opencv2/core/opencl/runtime/opencl_core.hpp" diff --git a/modules/core/src/matrix_c.cpp b/modules/core/src/matrix_c.cpp index 1c3e58857c..2fead4100c 100644 --- a/modules/core/src/matrix_c.cpp +++ b/modules/core/src/matrix_c.cpp @@ -1,6 +1,10 @@ +// 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 "precomp.hpp" #include "opencv2/core/mat.hpp" #include "opencv2/core/types_c.h" -#include "precomp.hpp" // glue diff --git a/modules/core/src/matrix_iterator.cpp b/modules/core/src/matrix_iterator.cpp index aaa7f4aa01..ce7c191cbe 100644 --- a/modules/core/src/matrix_iterator.cpp +++ b/modules/core/src/matrix_iterator.cpp @@ -2,9 +2,8 @@ // 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 "opencv2/core/mat.hpp" #include "precomp.hpp" +#include "opencv2/core/mat.hpp" namespace cv { diff --git a/modules/core/src/matrix_operations.cpp b/modules/core/src/matrix_operations.cpp index 22ed50cf19..6f863b8871 100644 --- a/modules/core/src/matrix_operations.cpp +++ b/modules/core/src/matrix_operations.cpp @@ -2,11 +2,10 @@ // 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 "precomp.hpp" #include "opencv2/core/mat.hpp" #include "opencv2/core/types_c.h" #include "opencl_kernels_core.hpp" -#include "precomp.hpp" #undef HAVE_IPP #undef CV_IPP_RUN_FAST diff --git a/modules/core/src/matrix_sparse.cpp b/modules/core/src/matrix_sparse.cpp index 05d16d706e..21e7e91151 100644 --- a/modules/core/src/matrix_sparse.cpp +++ b/modules/core/src/matrix_sparse.cpp @@ -2,10 +2,9 @@ // 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 "precomp.hpp" #include "opencv2/core/mat.hpp" #include "opencv2/core/types_c.h" -#include "precomp.hpp" namespace cv { diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index f0b5b895c4..ad697d204c 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -2,9 +2,8 @@ // 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 "opencv2/core/mat.hpp" #include "precomp.hpp" +#include "opencv2/core/mat.hpp" namespace cv { From 0885a79c28a8a69be844f0cfc6bdd17a8d133fbe Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 16 Feb 2021 12:32:58 +0000 Subject: [PATCH 09/17] imgcodecs(test): don't include png.h --- modules/imgcodecs/CMakeLists.txt | 4 ++++ modules/imgcodecs/test/test_png.cpp | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt index 92f380ea22..4f0dc81391 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt @@ -149,4 +149,8 @@ ocv_add_accuracy_tests() if(TARGET opencv_test_imgcodecs AND HAVE_JASPER AND "$ENV{OPENCV_IO_ENABLE_JASPER}") ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_ENABLE_JASPER_TESTS=1) endif() +if(TARGET opencv_test_imgcodecs AND HAVE_PNG AND NOT (PNG_VERSION VERSION_LESS "1.6.31")) + # details: https://github.com/glennrp/libpng/commit/68cb0aaee3de6371b81a4613476d9b33e43e95b1 + ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_PNG_WITH_EXIF=1) +endif() ocv_add_perf_tests() diff --git a/modules/imgcodecs/test/test_png.cpp b/modules/imgcodecs/test/test_png.cpp index 74920ee9ae..f71fabc7e4 100644 --- a/modules/imgcodecs/test/test_png.cpp +++ b/modules/imgcodecs/test/test_png.cpp @@ -7,12 +7,6 @@ namespace opencv_test { namespace { #ifdef HAVE_PNG -#ifdef HAVE_LIBPNG_PNG_H -#include -#else -#include -#endif - TEST(Imgcodecs_Png, write_big) { const string root = cvtest::TS::ptr()->get_data_path(); @@ -99,7 +93,6 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha) EXPECT_EQ(img.at(0, 1), Vec3b(0, 0, 255)); } -#ifdef PNG_eXIf_SUPPORTED /** * Test for check whether reading exif orientation tag was processed successfully or not * The test info is the set of 8 images named testExifRotate_{1 to 8}.png @@ -144,7 +137,11 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha) typedef testing::TestWithParam Imgcodecs_PNG_Exif; // Solution to issue 16579: PNG read doesn't support Exif orientation data +#ifdef OPENCV_IMGCODECS_PNG_WITH_EXIF TEST_P(Imgcodecs_PNG_Exif, exif_orientation) +#else +TEST_P(Imgcodecs_PNG_Exif, DISABLED_exif_orientation) +#endif { const string root = cvtest::TS::ptr()->get_data_path(); const string filename = root + GetParam(); @@ -188,7 +185,6 @@ const string exif_files[] = INSTANTIATE_TEST_CASE_P(ExifFiles, Imgcodecs_PNG_Exif, testing::ValuesIn(exif_files)); -#endif // PNG_eXIf_SUPPORTED #endif // HAVE_PNG From 0a7a54f312d86640fa296a03653059916da77c2e Mon Sep 17 00:00:00 2001 From: Matt Alvarado Date: Tue, 16 Feb 2021 11:18:43 -0500 Subject: [PATCH 10/17] Merge pull request #19498 from mattalvarado:fix_findcirclesgrid * Properly handle empty centers in findCirclesGrid * Address alalek comments. Add unit test to validate bugfix * fix build warnings, remove unrelated comment --- modules/calib3d/src/calibinit.cpp | 2 +- modules/calib3d/test/test_chesscorners.cpp | 40 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 1332d51ba6..0a8cdd5c6f 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -2274,7 +2274,7 @@ bool findCirclesGrid2(InputArray _image, Size patternSize, } } - if (!H.empty()) // undone rectification + if (!centers.empty() && !H.empty()) // undone rectification { Mat orgPointsMat; transform(centers, orgPointsMat, H.inv()); diff --git a/modules/calib3d/test/test_chesscorners.cpp b/modules/calib3d/test/test_chesscorners.cpp index f2cf8a8116..3792ca1bc7 100644 --- a/modules/calib3d/test/test_chesscorners.cpp +++ b/modules/calib3d/test/test_chesscorners.cpp @@ -541,5 +541,45 @@ TEST(Calib3d_AsymmetricCirclesPatternDetector, regression_18713) } } +TEST(Calib3d_AsymmetricCirclesPatternDetector, regression_19498) +{ + float pts_[121][2] = { + { 84.7462f, 404.504f }, { 49.1586f, 404.092f }, { 12.3362f, 403.434f }, { 102.542f, 386.214f }, { 67.6042f, 385.475f }, + { 31.4982f, 384.569f }, { 141.231f, 377.856f }, { 332.834f, 370.745f }, { 85.7663f, 367.261f }, { 50.346f, 366.051f }, + { 13.7726f, 364.663f }, { 371.746f, 362.011f }, { 68.8543f, 347.883f }, { 32.9334f, 346.263f }, { 331.926f, 343.291f }, + { 351.535f, 338.112f }, { 51.7951f, 328.247f }, { 15.4613f, 326.095f }, { 311.719f, 319.578f }, { 330.947f, 313.708f }, + { 256.706f, 307.584f }, { 34.6834f, 308.167f }, { 291.085f, 295.429f }, { 17.4316f, 287.824f }, { 252.928f, 277.92f }, + { 270.19f, 270.93f }, { 288.473f, 263.484f }, { 216.401f, 260.94f }, { 232.195f, 253.656f }, { 266.757f, 237.708f }, + { 211.323f, 229.005f }, { 227.592f, 220.498f }, { 154.749f, 188.52f }, { 222.52f, 184.906f }, { 133.85f, 163.968f }, + { 200.024f, 158.05f }, { 147.485f, 153.643f }, { 161.967f, 142.633f }, { 177.396f, 131.059f }, { 125.909f, 128.116f }, + { 139.817f, 116.333f }, { 91.8639f, 114.454f }, { 104.343f, 102.542f }, { 117.635f, 89.9116f }, { 70.9465f, 89.4619f }, + { 82.8524f, 76.7862f }, { 131.738f, 76.4741f }, { 95.5012f, 63.3351f }, { 109.034f, 49.0424f }, { 314.886f, 374.711f }, + { 351.735f, 366.489f }, { 279.113f, 357.05f }, { 313.371f, 348.131f }, { 260.123f, 335.271f }, { 276.346f, 330.325f }, + { 293.588f, 325.133f }, { 240.86f, 313.143f }, { 273.436f, 301.667f }, { 206.762f, 296.574f }, { 309.877f, 288.796f }, + { 187.46f, 274.319f }, { 201.521f, 267.804f }, { 248.973f, 245.918f }, { 181.644f, 244.655f }, { 196.025f, 237.045f }, + { 148.41f, 229.131f }, { 161.604f, 221.215f }, { 175.455f, 212.873f }, { 244.748f, 211.459f }, { 128.661f, 206.109f }, + { 190.217f, 204.108f }, { 141.346f, 197.568f }, { 205.876f, 194.781f }, { 168.937f, 178.948f }, { 121.006f, 173.714f }, + { 183.998f, 168.806f }, { 88.9095f, 159.731f }, { 100.559f, 149.867f }, { 58.553f, 146.47f }, { 112.849f, 139.302f }, + { 80.0968f, 125.74f }, { 39.24f, 123.671f }, { 154.582f, 103.85f }, { 59.7699f, 101.49f }, { 266.334f, 385.387f }, + { 234.053f, 368.718f }, { 263.347f, 361.184f }, { 244.763f, 339.958f }, { 198.16f, 328.214f }, { 211.675f, 323.407f }, + { 225.905f, 318.426f }, { 192.98f, 302.119f }, { 221.267f, 290.693f }, { 161.437f, 286.46f }, { 236.656f, 284.476f }, + { 168.023f, 251.799f }, { 105.385f, 221.988f }, { 116.724f, 214.25f }, { 97.2959f, 191.81f }, { 108.89f, 183.05f }, + { 77.9896f, 169.242f }, { 48.6763f, 156.088f }, { 68.9635f, 136.415f }, { 29.8484f, 133.886f }, { 49.1966f, 112.826f }, + { 113.059f, 29.003f }, { 251.698f, 388.562f }, { 281.689f, 381.929f }, { 297.875f, 378.518f }, { 248.376f, 365.025f }, + { 295.791f, 352.763f }, { 216.176f, 348.586f }, { 230.143f, 344.443f }, { 179.89f, 307.457f }, { 174.083f, 280.51f }, + { 142.867f, 265.085f }, { 155.127f, 258.692f }, { 124.187f, 243.661f }, { 136.01f, 236.553f }, { 86.4651f, 200.13f }, + { 67.5711f, 178.221f } + }; + + Mat candidates(121, 1, CV_32FC2, (void*)pts_); + Size patternSize(13, 8); + + std::vector< Point2f > result; + bool res = false; + + EXPECT_NO_THROW(res = findCirclesGrid(candidates, patternSize, result, CALIB_CB_SYMMETRIC_GRID, Ptr()/*blobDetector=NULL*/)); + EXPECT_FALSE(res); +} + }} // namespace /* End of file. */ From f76ba285c9362f4a5efb6dcf4ca11028ab03891e Mon Sep 17 00:00:00 2001 From: Nicola Landolfi Date: Wed, 17 Feb 2021 10:03:16 +0100 Subject: [PATCH 11/17] Fix single-word typo --- doc/tutorials/imgproc/pyramids/pyramids.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorials/imgproc/pyramids/pyramids.markdown b/doc/tutorials/imgproc/pyramids/pyramids.markdown index 90cb5652b0..2c9a7ec8d3 100644 --- a/doc/tutorials/imgproc/pyramids/pyramids.markdown +++ b/doc/tutorials/imgproc/pyramids/pyramids.markdown @@ -163,7 +163,7 @@ Our program exits if the user presses **ESC**. Besides, it has two options: We use the function **pyrDown()** with three arguments (similarly to **pyrUp()**): - *src*: The current and destination image (to be shown on screen, supposedly half the input image) - - *Size( tmp.cols/2, tmp.rows/2 )* : The destination size. Since we are upsampling, + - *Size( tmp.cols/2, tmp.rows/2 )* : The destination size. Since we are downsampling, **pyrDown()** expects half the size the input image (in this case *src*). @add_toggle_cpp From 601851cc7e3f82236734d2a2ceaa420bea7faeee Mon Sep 17 00:00:00 2001 From: Aryansh Omray Date: Wed, 17 Feb 2021 18:49:52 +0530 Subject: [PATCH 12/17] TanH darknet and test --- modules/dnn/src/darknet/darknet_io.cpp | 4 ++++ modules/dnn/test/test_darknet_importer.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/modules/dnn/src/darknet/darknet_io.cpp b/modules/dnn/src/darknet/darknet_io.cpp index f6d71fd6d4..e3c978a8c0 100644 --- a/modules/dnn/src/darknet/darknet_io.cpp +++ b/modules/dnn/src/darknet/darknet_io.cpp @@ -241,6 +241,10 @@ namespace cv { { activation_param.type = "Sigmoid"; } + else if (type == "tanh") + { + activation_param.type = "TanH"; + } else { CV_Error(cv::Error::StsParseError, "Unsupported activation: " + type); diff --git a/modules/dnn/test/test_darknet_importer.cpp b/modules/dnn/test/test_darknet_importer.cpp index 0ecec8c49b..00638f83c5 100644 --- a/modules/dnn/test/test_darknet_importer.cpp +++ b/modules/dnn/test/test_darknet_importer.cpp @@ -702,6 +702,11 @@ TEST_P(Test_Darknet_layers, mish) testDarknetLayer("mish", true); } +TEST_P(Test_Darknet_layers, tanh) +{ + testDarknetLayer("tanh"); +} + TEST_P(Test_Darknet_layers, avgpool_softmax) { testDarknetLayer("avgpool_softmax"); From eb901866147707d12a90479b489bd26667e4c3c4 Mon Sep 17 00:00:00 2001 From: Anastasia M Date: Wed, 17 Feb 2021 21:01:41 +0300 Subject: [PATCH 13/17] Merge pull request #19417 from LupusSanctus:am/text_graph_identity * Corrected SSD text graph generation for Identity nodes * Added minor code corrections --- samples/dnn/tf_text_graph_common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/dnn/tf_text_graph_common.py b/samples/dnn/tf_text_graph_common.py index ea24898873..c82053b4fb 100644 --- a/samples/dnn/tf_text_graph_common.py +++ b/samples/dnn/tf_text_graph_common.py @@ -270,7 +270,11 @@ def removeIdentity(graph_def): identities = {} for node in graph_def.node: if node.op == 'Identity' or node.op == 'IdentityN': - identities[node.name] = node.input[0] + inp = node.input[0] + if inp in identities: + identities[node.name] = identities[inp] + else: + identities[node.name] = inp graph_def.node.remove(node) for node in graph_def.node: From 96570820ef614ab49b9973776aac421346698805 Mon Sep 17 00:00:00 2001 From: APrigarina Date: Thu, 18 Feb 2021 16:18:19 +0300 Subject: [PATCH 14/17] handle empty cameraMatrix --- .../calib3d/camera_calibration/camera_calibration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp index 87fb4604e2..a6f87f41e8 100644 --- a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp +++ b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp @@ -417,7 +417,7 @@ int main(int argc, char* argv[]) // -----------------------Show the undistorted image for the image list ------------------------ //! [show_results] - if( s.inputType == Settings::IMAGE_LIST && s.showUndistorsed ) + if( s.inputType == Settings::IMAGE_LIST && s.showUndistorsed && !cameraMatrix.empty()) { Mat view, rview, map1, map2; From 4badf640bf54207e19ba8ced1c41798e1d28b7d0 Mon Sep 17 00:00:00 2001 From: Dale Phurrough Date: Sat, 20 Feb 2021 14:16:47 +0100 Subject: [PATCH 15/17] add noexcept to default constructors of cv::ocl - follows iso c++ guideline C.44 - enables default compiler-created constructors to also be noexcept original commit: 77e26a7db3447b7569dfee28fb8a253b8ed93e2b - handled KernelArg, Image2D --- modules/core/include/opencv2/core/ocl.hpp | 20 ++++++++++---------- modules/core/src/ocl.cpp | 23 +++++++++++++---------- modules/core/src/ocl_disabled.impl.hpp | 20 ++++++++++---------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/modules/core/include/opencv2/core/ocl.hpp b/modules/core/include/opencv2/core/ocl.hpp index ca46cdc38a..f03de180fc 100644 --- a/modules/core/include/opencv2/core/ocl.hpp +++ b/modules/core/include/opencv2/core/ocl.hpp @@ -70,7 +70,7 @@ class CV_EXPORTS Image2D; class CV_EXPORTS_W_SIMPLE Device { public: - CV_WRAP Device(); + CV_WRAP Device() CV_NOEXCEPT; explicit Device(void* d); Device(const Device& d); Device& operator = (const Device& d); @@ -238,7 +238,7 @@ protected: class CV_EXPORTS Context { public: - Context(); + Context() CV_NOEXCEPT; explicit Context(int dtype); ~Context(); Context(const Context& c); @@ -269,7 +269,7 @@ public: class CV_EXPORTS Platform { public: - Platform(); + Platform() CV_NOEXCEPT; ~Platform(); Platform(const Platform& p); Platform& operator = (const Platform& p); @@ -324,7 +324,7 @@ void initializeContextFromHandle(Context& ctx, void* platform, void* context, vo class CV_EXPORTS Queue { public: - Queue(); + Queue() CV_NOEXCEPT; explicit Queue(const Context& c, const Device& d=Device()); ~Queue(); Queue(const Queue& q); @@ -350,7 +350,7 @@ class CV_EXPORTS KernelArg public: enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 }; KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0); - KernelArg(); + KernelArg() CV_NOEXCEPT; static KernelArg Local(size_t localMemSize) { return KernelArg(LOCAL, 0, 1, 1, 0, localMemSize); } @@ -387,7 +387,7 @@ public: class CV_EXPORTS Kernel { public: - Kernel(); + Kernel() CV_NOEXCEPT; Kernel(const char* kname, const Program& prog); Kernel(const char* kname, const ProgramSource& prog, const String& buildopts = String(), String* errmsg=0); @@ -597,7 +597,7 @@ protected: class CV_EXPORTS Program { public: - Program(); + Program() CV_NOEXCEPT; Program(const ProgramSource& src, const String& buildflags, String& errmsg); Program(const Program& prog); @@ -642,7 +642,7 @@ class CV_EXPORTS ProgramSource public: typedef uint64 hash_t; // deprecated - ProgramSource(); + ProgramSource() CV_NOEXCEPT; explicit ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash); explicit ProgramSource(const String& prog); // deprecated explicit ProgramSource(const char* prog); // deprecated @@ -711,7 +711,7 @@ protected: class CV_EXPORTS PlatformInfo { public: - PlatformInfo(); + PlatformInfo() CV_NOEXCEPT; explicit PlatformInfo(void* id); ~PlatformInfo(); @@ -776,7 +776,7 @@ CV_EXPORTS void buildOptionsAddMatrixDescription(String& buildOptions, const Str class CV_EXPORTS Image2D { public: - Image2D(); + Image2D() CV_NOEXCEPT; /** @param src UMat object from which to get image properties and data diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index df5f1e970e..466c63b496 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -1114,7 +1114,7 @@ struct Platform::Impl bool initialized; }; -Platform::Platform() +Platform::Platform() CV_NOEXCEPT { p = 0; } @@ -1310,7 +1310,7 @@ struct Device::Impl }; -Device::Device() +Device::Device() CV_NOEXCEPT { p = 0; } @@ -2283,7 +2283,7 @@ struct Context::Impl }; -Context::Context() +Context::Context() CV_NOEXCEPT { p = 0; } @@ -2654,7 +2654,7 @@ struct Queue::Impl cv::ocl::Queue profiling_queue_; }; -Queue::Queue() +Queue::Queue() CV_NOEXCEPT { p = 0; } @@ -2734,7 +2734,7 @@ static cl_command_queue getQueue(const Queue& q) /////////////////////////////////////////// KernelArg ///////////////////////////////////////////// -KernelArg::KernelArg() +KernelArg::KernelArg() CV_NOEXCEPT : flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1) { } @@ -2876,7 +2876,7 @@ static void CL_CALLBACK oclCleanupCallback(cl_event e, cl_int, void *p) namespace cv { namespace ocl { -Kernel::Kernel() +Kernel::Kernel() CV_NOEXCEPT { p = 0; } @@ -3466,7 +3466,7 @@ struct ProgramSource::Impl }; -ProgramSource::ProgramSource() +ProgramSource::ProgramSource() CV_NOEXCEPT { p = 0; } @@ -3975,7 +3975,10 @@ struct Program::Impl }; -Program::Program() { p = 0; } +Program::Program() CV_NOEXCEPT +{ + p = 0; +} Program::Program(const ProgramSource& src, const String& buildflags, String& errmsg) @@ -5999,7 +6002,7 @@ struct PlatformInfo::Impl int versionMinor_; }; -PlatformInfo::PlatformInfo() +PlatformInfo::PlatformInfo() CV_NOEXCEPT { p = 0; } @@ -6566,7 +6569,7 @@ struct Image2D::Impl cl_mem handle; }; -Image2D::Image2D() +Image2D::Image2D() CV_NOEXCEPT { p = NULL; } diff --git a/modules/core/src/ocl_disabled.impl.hpp b/modules/core/src/ocl_disabled.impl.hpp index a0516476bf..4973f12f02 100644 --- a/modules/core/src/ocl_disabled.impl.hpp +++ b/modules/core/src/ocl_disabled.impl.hpp @@ -34,7 +34,7 @@ CV_EXPORTS_W void finish() { /* nothing */ } CV_EXPORTS bool haveSVM() { return false; } -Device::Device() : p(NULL) { } +Device::Device() CV_NOEXCEPT : p(NULL) { } Device::Device(void* d) : p(NULL) { OCL_NOT_AVAILABLE(); } Device::Device(const Device& d) : p(NULL) { } Device& Device::operator=(const Device& d) { return *this; } @@ -145,7 +145,7 @@ const Device& Device::getDefault() } -Context::Context() : p(NULL) { } +Context::Context() CV_NOEXCEPT : p(NULL) { } Context::Context(int dtype) : p(NULL) { } Context::~Context() { } Context::Context(const Context& c) : p(NULL) { } @@ -169,7 +169,7 @@ void* Context::ptr() const { return NULL; } bool Context::useSVM() const { return false; } void Context::setUseSVM(bool enabled) { } -Platform::Platform() : p(NULL) { } +Platform::Platform() CV_NOEXCEPT : p(NULL) { } Platform::~Platform() { } Platform::Platform(const Platform&) : p(NULL) { } Platform& Platform::operator=(const Platform&) { return *this; } @@ -189,7 +189,7 @@ void convertFromImage(void* cl_mem_image, UMat& dst) { OCL_NOT_AVAILABLE(); } void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device) { OCL_NOT_AVAILABLE(); } -Queue::Queue() : p(NULL) { } +Queue::Queue() CV_NOEXCEPT : p(NULL) { } Queue::Queue(const Context& c, const Device& d) : p(NULL) { OCL_NOT_AVAILABLE(); } Queue::~Queue() { } Queue::Queue(const Queue& q) {} @@ -209,7 +209,7 @@ Queue& Queue::getDefault() const Queue& Queue::getProfilingQueue() const { OCL_NOT_AVAILABLE(); } -KernelArg::KernelArg() +KernelArg::KernelArg() CV_NOEXCEPT : flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1) { } @@ -226,7 +226,7 @@ KernelArg KernelArg::Constant(const Mat& m) } -Kernel::Kernel() : p(NULL) { } +Kernel::Kernel() CV_NOEXCEPT : p(NULL) { } Kernel::Kernel(const char* kname, const Program& prog) : p(NULL) { OCL_NOT_AVAILABLE(); } Kernel::Kernel(const char* kname, const ProgramSource& prog, const String& buildopts, String* errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); } Kernel::~Kernel() { } @@ -255,7 +255,7 @@ size_t Kernel::localMemSize() const { OCL_NOT_AVAILABLE(); } void* Kernel::ptr() const { return NULL; } -Program::Program() : p(NULL) { } +Program::Program() CV_NOEXCEPT : p(NULL) { } Program::Program(const ProgramSource& src, const String& buildflags, String& errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); } Program::Program(const Program& prog) : p(NULL) { } Program& Program::operator=(const Program& prog) { return *this; } @@ -274,7 +274,7 @@ String Program::getPrefix() const { OCL_NOT_AVAILABLE(); } /* static */ String Program::getPrefix(const String& buildflags) { OCL_NOT_AVAILABLE(); } -ProgramSource::ProgramSource() : p(NULL) { } +ProgramSource::ProgramSource() CV_NOEXCEPT : p(NULL) { } ProgramSource::ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash) : p(NULL) { } ProgramSource::ProgramSource(const String& prog) : p(NULL) { } ProgramSource::ProgramSource(const char* prog) : p(NULL) { } @@ -289,7 +289,7 @@ ProgramSource::hash_t ProgramSource::hash() const { OCL_NOT_AVAILABLE(); } /* static */ ProgramSource ProgramSource::fromSPIR(const String& module, const String& name, const unsigned char* binary, const size_t size, const cv::String& buildOptions) { OCL_NOT_AVAILABLE(); } -PlatformInfo::PlatformInfo() : p(NULL) { } +PlatformInfo::PlatformInfo() CV_NOEXCEPT : p(NULL) { } PlatformInfo::PlatformInfo(void* id) : p(NULL) { OCL_NOT_AVAILABLE(); } PlatformInfo::~PlatformInfo() { } @@ -332,7 +332,7 @@ int predictOptimalVectorWidthMax(InputArray src1, InputArray src2, InputArray sr void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m) { OCL_NOT_AVAILABLE(); } -Image2D::Image2D() : p(NULL) { } +Image2D::Image2D() CV_NOEXCEPT : p(NULL) { } Image2D::Image2D(const UMat &src, bool norm, bool alias) { OCL_NOT_AVAILABLE(); } Image2D::Image2D(const Image2D & i) : p(NULL) { OCL_NOT_AVAILABLE(); } Image2D::~Image2D() { } From af13f61a4353ede667f5907274511f58d8c536ad Mon Sep 17 00:00:00 2001 From: Sergey Krivohatskiy Date: Sun, 21 Feb 2021 18:57:18 +0300 Subject: [PATCH 16/17] Merge pull request #19580 from SergeyKrivohatskiy:patch-1 * Fixed OCL implementation of pyrlk If prevPts size is (N, 1) (which is a default layout for converting `vector` to `UMat`) the `prevPts.cols == 1` and optical flow will be calculated for the first point only. Getting `prevPts.total()` as in line 1048 is the correct way to get points count. * fixed compilation warning (size_t to int) Signed-off-by: Sergey Krivohatskiy --- modules/video/src/lkpyramid.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/video/src/lkpyramid.cpp b/modules/video/src/lkpyramid.cpp index 8df531448a..657b3ced4b 100644 --- a/modules/video/src/lkpyramid.cpp +++ b/modules/video/src/lkpyramid.cpp @@ -938,7 +938,8 @@ namespace { if (!lkSparse_run(prevPyr[level], nextPyr[level], prevPts, nextPts, status, err, - prevPts.cols, level)) + static_cast(prevPts.total()), + level)) return false; } return true; From 98c2ccfaa33707607916a895fd8d594f44b58498 Mon Sep 17 00:00:00 2001 From: Larry Wei Date: Mon, 22 Feb 2021 03:22:43 +0800 Subject: [PATCH 17/17] Merge pull request #19586 from larryw3i:patch-2 * Update py_setup_in_ubuntu.markdown --- .../py_setup/py_setup_in_ubuntu/py_setup_in_ubuntu.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/py_tutorials/py_setup/py_setup_in_ubuntu/py_setup_in_ubuntu.markdown b/doc/py_tutorials/py_setup/py_setup_in_ubuntu/py_setup_in_ubuntu.markdown index f88ffe6793..8b99c5df92 100644 --- a/doc/py_tutorials/py_setup/py_setup_in_ubuntu/py_setup_in_ubuntu.markdown +++ b/doc/py_tutorials/py_setup/py_setup_in_ubuntu/py_setup_in_ubuntu.markdown @@ -22,10 +22,10 @@ Installing OpenCV-Python from Pre-built Binaries This method serves best when using just for programming and developing OpenCV applications. -Install package [python-opencv](https://packages.ubuntu.com/trusty/python-opencv) with following command in terminal (as root user). +Install package [python3-opencv](https://packages.ubuntu.com/focal/python3-opencv) with following command in terminal (as root user). ``` -$ sudo apt-get install python-opencv +$ sudo apt-get install python3-opencv ``` Open Python IDLE (or IPython) and type following codes in Python terminal.