Merge remote-tracking branch 'upstream/3.4' into merge-3.4
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Wed, 26 Jun 2019 20:17:19 +0000 (20:17 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Wed, 26 Jun 2019 20:19:04 +0000 (20:19 +0000)
20 files changed:
1  2 
modules/calib3d/CMakeLists.txt
modules/dnn/src/layers/elementwise_layers.cpp
modules/dnn/src/layers/eltwise_layer.cpp
modules/dnn/src/op_inf_engine.cpp
modules/dnn/src/tensorflow/tf_importer.cpp
modules/dnn/test/test_backends.cpp
modules/dnn/test/test_common.hpp
modules/dnn/test/test_common.impl.hpp
modules/dnn/test/test_main.cpp
modules/dnn/test/test_misc.cpp
modules/imgproc/src/grabcut.cpp
modules/imgproc/test/test_filter.cpp
modules/js/src/embindgen.py
modules/js/test/tests.html
modules/js/test/tests.js
modules/ts/include/opencv2/ts.hpp
modules/ts/src/ts.cpp
modules/videoio/src/cap_mfx_common.cpp
platforms/js/build_js.py
samples/dnn/js_face_recognition.html

@@@ -3,4 -3,6 +3,6 @@@ set(debug_modules ""
  if(DEBUG_opencv_calib3d)
    list(APPEND debug_modules opencv_highgui)
  endif()
- ocv_define_module(calib3d opencv_imgproc opencv_features2d opencv_flann ${debug_modules} WRAP java python)
 -ocv_define_module(calib3d opencv_imgproc opencv_features2d ${debug_modules}
++ocv_define_module(calib3d opencv_imgproc opencv_features2d opencv_flann ${debug_modules}
+     WRAP java python js
+ )
Simple merge
Simple merge
  #include "opencv2/core/ocl.hpp"
  #endif
  
+ #define CV_TEST_TAG_DNN_SKIP_HALIDE              "dnn_skip_halide"
+ #define CV_TEST_TAG_DNN_SKIP_OPENCL              "dnn_skip_ocl"
+ #define CV_TEST_TAG_DNN_SKIP_OPENCL_FP16         "dnn_skip_ocl_fp16"
+ #define CV_TEST_TAG_DNN_SKIP_IE                  "dnn_skip_ie"
+ #define CV_TEST_TAG_DNN_SKIP_IE_2018R5           "dnn_skip_ie_2018r5"
+ #define CV_TEST_TAG_DNN_SKIP_IE_2019R1           "dnn_skip_ie_2019r1"
+ #define CV_TEST_TAG_DNN_SKIP_IE_2019R1_1         "dnn_skip_ie_2019r1_1"
+ #define CV_TEST_TAG_DNN_SKIP_IE_OPENCL           "dnn_skip_ie_ocl"
+ #define CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16      "dnn_skip_ie_ocl_fp16"
+ #define CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2         "dnn_skip_ie_myriad2"
+ #define CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X         "dnn_skip_ie_myriadx"
+ #define CV_TEST_TAG_DNN_SKIP_IE_MYRIAD           CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2, CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
++#define CV_TEST_TAG_DNN_SKIP_VULKAN              "dnn_skip_vulkan"
  
  namespace cv { namespace dnn {
 -CV__DNN_EXPERIMENTAL_NS_BEGIN
 +CV__DNN_INLINE_NS_BEGIN
  
  void PrintTo(const cv::dnn::Backend& v, std::ostream* os);
  void PrintTo(const cv::dnn::Target& v, std::ostream* os);
@@@ -289,4 -288,38 +297,43 @@@ bool validateVPUType(
  }
  #endif // HAVE_INF_ENGINE
  
+ void initDNNTests()
+ {
+     const char* extraTestDataPath =
+ #ifdef WINRT
+         NULL;
+ #else
+         getenv("OPENCV_DNN_TEST_DATA_PATH");
+ #endif
+     if (extraTestDataPath)
+         cvtest::addDataSearchPath(extraTestDataPath);
+     registerGlobalSkipTag(
+         CV_TEST_TAG_DNN_SKIP_HALIDE,
+         CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16
+     );
+ #if defined(INF_ENGINE_RELEASE)
+     registerGlobalSkipTag(
+ #if INF_ENGINE_VER_MAJOR_EQ(2018050000)
+         CV_TEST_TAG_DNN_SKIP_IE_2018R5,
+ #elif INF_ENGINE_VER_MAJOR_EQ(2019010000)
+         CV_TEST_TAG_DNN_SKIP_IE_2019R1,
+ #elif INF_ENGINE_VER_MAJOR_EQ(2019010100)
+         CV_TEST_TAG_DNN_SKIP_IE_2019R1_1
+ #endif
+         CV_TEST_TAG_DNN_SKIP_IE
+     );
+ #endif
+     registerGlobalSkipTag(
+         // see validateVPUType(): CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2, CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X
+         CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16
+     );
++#ifdef HAVE_VULKAN
++    registerGlobalSkipTag(
++        CV_TEST_TAG_DNN_SKIP_VULKAN
++    );
++#endif
+ }
  } // namespace
@@@ -1,24 -1,3 +1,7 @@@
  #include "test_precomp.hpp"
  
- static const char* extraTestDataPath =
- #ifdef WINRT
-         NULL;
- #else
-         getenv("OPENCV_DNN_TEST_DATA_PATH");
- #endif
 +#if defined(HAVE_HPX)
 +    #include <hpx/hpx_main.hpp>
 +#endif
 +
- CV_TEST_MAIN("",
-     extraTestDataPath ? (void)cvtest::addDataSearchPath(extraTestDataPath) : (void)0
- )
- namespace opencv_test
- {
- using namespace cv;
- using namespace cv::dnn;
- }
+ CV_TEST_MAIN("", initDNNTests());
@@@ -158,9 -158,7 +158,9 @@@ TEST_P(setInput, normalization
      const bool kSwapRB = true;
  
      if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 && dtype != CV_32F)
-         throw SkipTestException("");
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
 +    if (backend == DNN_BACKEND_VKCOM && dtype != CV_32F)
-         throw SkipTestException("");
++        throw SkipTestException(CV_TEST_TAG_DNN_SKIP_VULKAN);
  
      Mat inp(5, 5, CV_8UC3);
      randu(inp, 0, 255);
  #include <limits>
  
  using namespace cv;
 +using namespace detail;
  
+ namespace {
  /*
  This is implementation of image segmentation algorithm GrabCut described in
  "GrabCut - Interactive Foreground Extraction using Iterated Graph Cuts".
Simple merge
@@@ -142,34 -143,8 +143,36 @@@ features2d = {'Feature2D': ['detect', '
                'BFMatcher': ['isMaskSupported', 'create'],
                '': ['drawKeypoints', 'drawMatches']}
  
 +photo = {'': ['createAlignMTB', 'createCalibrateDebevec', 'createCalibrateRobertson', \
 +              'createMergeDebevec', 'createMergeMertens', 'createMergeRobertson', \
 +              'createTonemapDrago', 'createTonemapMantiuk', 'createTonemapReinhard'],
 +        'CalibrateCRF': ['process'],
 +        'AlignMTB' : ['calculateShift', 'shiftMat', 'computeBitmaps', 'getMaxBits', 'setMaxBits', \
 +                      'getExcludeRange', 'setExcludeRange', 'getCut', 'setCut'],
 +        'CalibrateDebevec' : ['getLambda', 'setLambda', 'getSamples', 'setSamples', 'getRandom', 'setRandom'],
 +        'CalibrateRobertson' : ['getMaxIter', 'setMaxIter', 'getThreshold', 'setThreshold', 'getRadiance'],
 +        'MergeExposures' : ['process'],
 +        'MergeDebevec' : ['process'],
 +        'MergeMertens' : ['process', 'getContrastWeight', 'setContrastWeight', 'getSaturationWeight', \
 +                          'setSaturationWeight', 'getExposureWeight', 'setExposureWeight'],
 +        'MergeRobertson' : ['process'],
 +        'Tonemap' : ['process' , 'getGamma', 'setGamma'],
 +        'TonemapDrago' : ['getSaturation', 'setSaturation', 'getBias', 'setBias', \
 +                          'getSigmaColor', 'setSigmaColor', 'getSigmaSpace','setSigmaSpace'],
 +        'TonemapMantiuk' : ['getScale', 'setScale', 'getSaturation', 'setSaturation'],
 +        'TonemapReinhard' : ['getIntensity', 'setIntensity', 'getLightAdaptation', 'setLightAdaptation', \
 +                             'getColorAdaptation', 'setColorAdaptation']
 +        }
 +
 +aruco = {'': ['detectMarkers', 'drawDetectedMarkers', 'drawAxis', 'estimatePoseSingleMarkers', 'estimatePoseBoard', 'interpolateCornersCharuco', 'drawDetectedCornersCharuco'],
 +        'aruco_Dictionary': ['get', 'drawMarker'],
 +        'aruco_Board': ['create'],
 +        'aruco_GridBoard': ['create', 'draw'],
 +        'aruco_CharucoBoard': ['create', 'draw'],
 +        }
 +
+ calib3d = {'': ['findHomography']}
  def makeWhiteList(module_list):
      wl = {}
      for m in module_list:
                  wl[k] = m[k]
      return wl
  
- white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco])
 -white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, calib3d])
++white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco, calib3d])
  
  # Features to be exported
  export_enums = False
@@@ -28,8 -28,8 +28,9 @@@
          <script type="application/javascript" src="test_imgproc.js"></script>
          <script type="application/javascript" src="test_objdetect.js"></script>
          <script type="application/javascript" src="test_video.js"></script>
 +        <script type="application/javascript" src="test_photo.js"></script>
          <script type="application/javascript" src="test_features2d.js"></script>
+         <script type="application/javascript" src="test_calib3d.js"></script>
          <script  type='text/javascript'>
              QUnit.config.autostart = false;
  
@@@ -46,7 -46,8 +46,9 @@@ testrunner.run
          code: 'opencv.js',
          tests: ['test_mat.js', 'test_utils.js', 'test_imgproc.js',
                  'test_objdetect.js', 'test_video.js', 'test_features2d.js',
-                 'test_photo.js'],
++                'test_photo.js',
+                 'test_calib3d.js'
+         ],
      },
      function(err, report) {
          console.log(report.failed + ' failed, ' + report.passed + ' passed');
Simple merge
Simple merge
@@@ -116,13 -115,12 +116,13 @@@ class Builder
                 "-DWITH_QUIRC=OFF",
                 "-DBUILD_ZLIB=ON",
                 "-DBUILD_opencv_apps=OFF",
-                "-DBUILD_opencv_calib3d=ON",  # No bindings provided. This module is used as a dependency for other modules.
+                "-DBUILD_opencv_calib3d=ON",
                 "-DBUILD_opencv_dnn=ON",
                 "-DBUILD_opencv_features2d=ON",
 -               "-DBUILD_opencv_flann=OFF",
 +               "-DBUILD_opencv_flann=ON",  # No bindings provided. This module is used as a dependency for other modules.
 +               "-DBUILD_opencv_gapi=OFF",
                 "-DBUILD_opencv_ml=OFF",
 -               "-DBUILD_opencv_photo=OFF",
 +               "-DBUILD_opencv_photo=ON",
                 "-DBUILD_opencv_imgcodecs=OFF",
                 "-DBUILD_opencv_shape=OFF",
                 "-DBUILD_opencv_videoio=OFF",
@@@ -68,7 -68,8 +68,8 @@@ function recognize(face) 
  //! [Recognize]
  
  function loadModels(callback) {
 -  var proto = 'https://raw.githubusercontent.com/opencv/opencv/3.4/samples/dnn/face_detector/deploy.prototxt';
+   var utils = new Utils('');
 +  var proto = 'https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt';
    var weights = 'https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel';
    var recognModel = 'https://raw.githubusercontent.com/pyannote/pyannote-data/master/openface.nn4.small2.v1.t7';
    utils.createFileFromUrl('face_detector.prototxt', proto, () => {