Merge remote-tracking branch 'upstream/3.4' into merge-3.4
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sun, 14 Aug 2022 15:50:42 +0000 (15:50 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sun, 14 Aug 2022 15:50:42 +0000 (15:50 +0000)
26 files changed:
1  2 
3rdparty/carotene/hal/CMakeLists.txt
cmake/OpenCVCompilerOptimizations.cmake
cmake/OpenCVCompilerOptions.cmake
cmake/OpenCVDetectCUDA.cmake
modules/calib3d/include/opencv2/calib3d.hpp
modules/calib3d/src/calibinit.cpp
modules/calib3d/src/five-point.cpp
modules/core/CMakeLists.txt
modules/core/include/opencv2/core/cv_cpu_dispatch.h
modules/core/include/opencv2/core/cv_cpu_helper.h
modules/core/include/opencv2/core/cvdef.h
modules/core/include/opencv2/core/hal/intrin_neon.hpp
modules/core/src/system.cpp
modules/core/test/test_utils.cpp
modules/dnn/src/layers/scale_layer.cpp
modules/dnn/src/onnx/onnx_importer.cpp
modules/dnn/test/test_onnx_importer.cpp
modules/features2d/src/sift.simd.hpp
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/src/drawing.cpp
modules/imgproc/src/pyramids.cpp
modules/js/src/core_bindings.cpp
modules/objdetect/test/test_precomp.hpp
modules/objdetect/test/test_qrcode_encode.cpp
modules/python/CMakeLists.txt
modules/python/package/cv2/__init__.py

Simple merge
  
  set(CPU_ALL_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F")
  list(APPEND CPU_ALL_OPTIMIZATIONS "AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
- list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
+ list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16 NEON_DOTPROD)
  list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
  list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
 +list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
  list(REMOVE_DUPLICATES CPU_ALL_OPTIMIZATIONS)
  
  ocv_update(CPU_VFPV3_FEATURE_ALIAS "")
@@@ -131,12 -131,10 +131,12 @@@ if(CV_GCC OR CV_CLANG
    add_extra_compiler_option(-Wundef)
    add_extra_compiler_option(-Winit-self)
    add_extra_compiler_option(-Wpointer-arith)
 -  add_extra_compiler_option(-Wshadow)
 +  if(NOT (CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0"))
 +    add_extra_compiler_option(-Wshadow)  # old GCC emits warnings for variables + methods combination
 +  endif()
    add_extra_compiler_option(-Wsign-promo)
    add_extra_compiler_option(-Wuninitialized)
-   if(CV_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
+   if(CV_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0 OR ARM))
      add_extra_compiler_option(-Wno-psabi)
    endif()
    if(HAVE_CXX11)
Simple merge
@@@ -2621,78 -2098,8 +2621,78 @@@ unit length
   */
  CV_EXPORTS_W void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t );
  
 +/** @brief Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
 +inliers that pass the check.
 +
 +@param points1 Array of N 2D points from the first image. The point coordinates should be
 +floating-point (single or double precision).
 +@param points2 Array of the second image points of the same size and format as points1 .
 +@param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
 +@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
 +@param distCoeffs1 Input/output vector of distortion coefficients, the same as in
 +@ref calibrateCamera.
 +@param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
 +@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
 +@param distCoeffs2 Input/output vector of distortion coefficients, the same as in
 +@ref calibrateCamera.
 +@param E The output essential matrix.
 +@param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
 +that performs a change of basis from the first camera's coordinate system to the second camera's
 +coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
 +described below.
 +@param t Output translation vector. This vector is obtained by @ref decomposeEssentialMat and
 +therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
 +length.
 +@param method Method for computing an essential matrix.
 +-   @ref RANSAC for the RANSAC algorithm.
 +-   @ref LMEDS for the LMedS algorithm.
 +@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
 +confidence (probability) that the estimated matrix is correct.
 +@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
 +line in pixels, beyond which the point is considered an outlier and is not used for computing the
 +final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
 +point localization, image resolution, and the image noise.
 +@param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
 +inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
 +recover pose. In the output mask only inliers which pass the cheirality check.
 +
 +This function decomposes an essential matrix using @ref decomposeEssentialMat and then verifies
 +possible pose hypotheses by doing cheirality check. The cheirality check means that the
 +triangulated 3D points should have positive depth. Some details can be found in @cite Nister03.
 +
 +This function can be used to process the output E and mask from @ref findEssentialMat. In this
 +scenario, points1 and points2 are the same input for findEssentialMat.:
 +@code
 +    // Example. Estimation of fundamental matrix using the RANSAC algorithm
 +    int point_count = 100;
 +    vector<Point2f> points1(point_count);
 +    vector<Point2f> points2(point_count);
 +
 +    // initialize the points here ...
 +    for( int i = 0; i < point_count; i++ )
 +    {
 +        points1[i] = ...;
 +        points2[i] = ...;
 +    }
 +
 +    // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
 +    Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
 +
 +    // Output: Essential matrix, relative rotation and relative translation.
 +    Mat E, R, t, mask;
 +
 +    recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
 +@endcode
 + */
 +CV_EXPORTS_W int recoverPose( InputArray points1, InputArray points2,
 +                            InputArray cameraMatrix1, InputArray distCoeffs1,
 +                            InputArray cameraMatrix2, InputArray distCoeffs2,
 +                            OutputArray E, OutputArray R, OutputArray t,
 +                            int method = cv::RANSAC, double prob = 0.999, double threshold = 1.0,
 +                            InputOutputArray mask = noArray());
 +
  /** @brief Recovers the relative camera rotation and the translation from an estimated essential
- matrix and the corresponding points in two images, using cheirality check. Returns the number of
+ matrix and the corresponding points in two images, using chirality check. Returns the number of
  inliers that pass the check.
  
  @param E The input essential matrix.
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1059,7 -725,8 +1059,9 @@@ TEST_P(Test_ONNX_layers, Div
  
      normAssert(ref, out, "", default_l1,  default_lInf);
      expectNoFallbacksFromIE(net);
 +    expectNoFallbacksFromCUDA(net);
+     testONNXModels("div_test_1x1",npy, 0, 0, false, true, 2);
  }
  
  TEST_P(Test_ONNX_layers, DynamicReshape)
Simple merge
@@@ -1866,6 -1847,12 +1866,12 @@@ void rectangle( InputOutputArray img, R
  {
      CV_INSTRUMENT_REGION();
  
 -    rec &= Rect(-(1 << shift), -(1 << shift), ((img.cols + 2) << shift),
 -                ((img.rows + 2) << shift));
+     CV_Assert( 0 <= shift && shift <= XY_SHIFT );
+     // Crop the rectangle to right around the mat.
++    rec &= Rect(-(1 << shift), -(1 << shift), ((img.cols() + 2) << shift),
++                ((img.rows() + 2) << shift));
      if( !rec.empty() )
          rectangle( img, rec.tl(), rec.br() - Point(1<<shift,1<<shift),
                     color, thickness, lineType, shift );
Simple merge
Simple merge
@@@ -6,5 -6,12 +6,11 @@@
  
  #include "opencv2/ts.hpp"
  #include "opencv2/objdetect.hpp"
 -#include "opencv2/objdetect/objdetect_c.h"
  
+ #if defined CV_CXX11
+   #include <random>
+ #else
+   #include <cstdlib>
+ #endif
  #endif
Simple merge