Merge remote-tracking branch 'upstream/3.4' into merge-3.4
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sun, 18 Dec 2022 02:16:17 +0000 (02:16 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sun, 18 Dec 2022 02:17:17 +0000 (02:17 +0000)
1  2 
modules/core/include/opencv2/core.hpp
modules/core/include/opencv2/core/bindings_utils.hpp
modules/core/src/parallel_impl.cpp
modules/features2d/include/opencv2/features2d.hpp
modules/imgproc/test/test_filter.cpp
modules/python/src2/gen2.py
modules/python/test/test_misc.py
modules/videoio/src/cap_avfoundation_mac.mm
samples/_winpack_run_python_sample.cmd

Simple merge
@@@ -227,11 -213,17 +227,22 @@@ AsyncArray testAsyncException(
      return p.getArrayResult();
  }
  
 +CV_WRAP static inline
 +String dumpVec2i(const cv::Vec2i value = cv::Vec2i(42, 24)) {
 +    return format("Vec2i(%d, %d)", value[0], value[1]);
 +}
 +
+ struct CV_EXPORTS_W_SIMPLE ClassWithKeywordProperties {
+     CV_PROP_RW int lambda;
+     CV_PROP int except;
+     CV_WRAP explicit ClassWithKeywordProperties(int lambda_arg = 24, int except_arg = 42)
+     {
+         lambda = lambda_arg;
+         except = except_arg;
+     }
+ };
  namespace nested {
  CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
      return flag;
Simple merge
Simple merge
@@@ -210,8 -210,7 +210,9 @@@ simple_argtype_mapping = 
      "float": ArgTypeInfo("float", FormatStrings.float, "0.f", True),
      "double": ArgTypeInfo("double", FormatStrings.double, "0", True),
      "c_string": ArgTypeInfo("char*", FormatStrings.string, '(char*)""'),
 +    "string": ArgTypeInfo("std::string", FormatStrings.object, None, True),
 +    "Stream": ArgTypeInfo("Stream", FormatStrings.object, 'Stream::Null()', True),
+     "UMat": ArgTypeInfo("UMat", FormatStrings.object, 'UMat()', True),  # FIXIT: switch to CV_EXPORTS_W_SIMPLE as UMat is already a some kind of smart pointer
  }
  
  # Set of reserved keywords for Python. Can be acquired via the following call
@@@ -728,44 -698,11 +735,44 @@@ class Arguments(NewOpenCVTests)
          self.assertEqual(
              params.float_value, instance.getFloatParam(),
              msg="Class initialized with wrong integer parameter. Expected: {}. Actual: {}".format(
-             params.float_value, instance.getFloatParam()
-         ))
+                 params.float_value, instance.getFloatParam()
+             )
+         )
  
  
 +
 +class CanUsePurePythonModuleFunction(NewOpenCVTests):
 +    def test_can_get_ocv_version(self):
 +        import sys
 +        if sys.version_info[0] < 3:
 +            raise unittest.SkipTest('Python 2.x is not supported')
 +
 +        self.assertEqual(cv.misc.get_ocv_version(), cv.__version__,
 +                         "Can't get package version using Python misc module")
 +
 +    def test_native_method_can_be_patched(self):
 +        import sys
 +
 +        if sys.version_info[0] < 3:
 +            raise unittest.SkipTest('Python 2.x is not supported')
 +
 +        res = cv.utils.testOverwriteNativeMethod(10)
 +        self.assertTrue(isinstance(res, Sequence),
 +                        msg="Overwritten method should return sequence. "
 +                            "Got: {} of type {}".format(res, type(res)))
 +        self.assertSequenceEqual(res, (11, 10),
 +                                 msg="Failed to overwrite native method")
 +        res = cv.utils._native.testOverwriteNativeMethod(123)
 +        self.assertEqual(res, 123, msg="Failed to call native method implementation")
 +
 +    def test_default_matx_argument(self):
 +        res = cv.utils.dumpVec2i()
 +        self.assertEqual(res, "Vec2i(42, 24)",
 +                         msg="Default argument is not properly handled")
 +        res = cv.utils.dumpVec2i((12, 21))
 +        self.assertEqual(res, "Vec2i(12, 21)")
 +
 +
  class SamplesFindFile(NewOpenCVTests):
  
      def test_ExistedFile(self):