From: Alexander Alekhin Date: Tue, 30 Apr 2019 19:59:49 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/3.4' into merge-3.4 X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~252 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e28e3c9491898502cfd64a3e145e56e5482b7891;p=platform%2Fupstream%2Fopencv.git Merge remote-tracking branch 'upstream/3.4' into merge-3.4 --- e28e3c9491898502cfd64a3e145e56e5482b7891 diff --cc modules/calib3d/include/opencv2/calib3d.hpp index b6f3b30,53b23d6..264c976 --- a/modules/calib3d/include/opencv2/calib3d.hpp +++ b/modules/calib3d/include/opencv2/calib3d.hpp @@@ -913,46 -848,8 +913,46 @@@ square grouping and ordering algorithm CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE ); +/* + Checks whether the image contains chessboard of the specific size or not. + If yes, nonzero value is returned. +*/ +CV_EXPORTS_W bool checkChessboard(InputArray img, Size size); + +/** @brief Finds the positions of internal corners of the chessboard using a sector based approach. + +@param image Source chessboard view. It must be an 8-bit grayscale or color image. +@param patternSize Number of inner corners per a chessboard row and column +( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ). +@param corners Output array of detected corners. +@param flags Various operation flags that can be zero or a combination of the following values: +- **CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with equalizeHist before detection. +- **CALIB_CB_EXHAUSTIVE ** Run an exhaustive search to improve detection rate. +- **CALIB_CB_ACCURACY ** Up sample input image to improve sub-pixel accuracy due to aliasing effects. +This should be used if an accurate camera calibration is required. + +The function is analog to findchessboardCorners but uses a localized radon +transformation approximated by box filters being more robust to all sort of +noise, faster on larger images and is able to directly return the sub-pixel +position of the internal chessboard corners. The Method is based on the paper +@cite duda2018 "Accurate Detection and Localization of Checkerboard Corners for +Calibration" demonstrating that the returned sub-pixel positions are more +accurate than the one returned by cornerSubPix allowing a precise camera +calibration for demanding applications. + +@note The function requires a white boarder with roughly the same width as one +of the checkerboard fields around the whole board to improve the detection in +various environments. In addition, because of the localized radon +transformation it is beneficial to use round corners for the field corners +which are located on the outside of the board. The following figure illustrates +a sample checkerboard optimized for the detection. However, any other checkerboard +can be used as well. +![Checkerboard](pics/checkerboard_radon.png) + */ +CV_EXPORTS_W bool findChessboardCornersSB(InputArray image,Size patternSize, OutputArray corners,int flags=0); + //! finds subpixel-accurate positions of the chessboard corners - CV_EXPORTS bool find4QuadCornerSubpix( InputArray img, InputOutputArray corners, Size region_size ); + CV_EXPORTS_W bool find4QuadCornerSubpix( InputArray img, InputOutputArray corners, Size region_size ); /** @brief Renders the detected chessboard corners. diff --cc modules/dnn/include/opencv2/dnn/version.hpp index b7a6a3f,0000000..6f53969 mode 100644,000000..100644 --- a/modules/dnn/include/opencv2/dnn/version.hpp +++ b/modules/dnn/include/opencv2/dnn/version.hpp @@@ -1,21 -1,0 +1,21 @@@ +// 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. + +#ifndef OPENCV_DNN_VERSION_HPP +#define OPENCV_DNN_VERSION_HPP + +/// Use with major OpenCV version only. - #define OPENCV_DNN_API_VERSION 20190422 ++#define OPENCV_DNN_API_VERSION 20190430 + +#if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_INLINE_NS +#define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION) +#define CV__DNN_INLINE_NS_BEGIN namespace CV__DNN_INLINE_NS { +#define CV__DNN_INLINE_NS_END } +namespace cv { namespace dnn { namespace CV__DNN_INLINE_NS { } using namespace CV__DNN_INLINE_NS; }} +#else +#define CV__DNN_INLINE_NS_BEGIN +#define CV__DNN_INLINE_NS_END +#endif + +#endif // OPENCV_DNN_VERSION_HPP diff --cc modules/dnn/src/layers/convolution_layer.cpp index 7e7ce04,3b298e6..bc4c782 --- a/modules/dnn/src/layers/convolution_layer.cpp +++ b/modules/dnn/src/layers/convolution_layer.cpp @@@ -243,9 -254,7 +255,13 @@@ public } else #endif - return (kernel_size.size() == 2) && (backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE); ++ { ++ if (kernel_size.size() != 2) ++ return false; + return backendId == DNN_BACKEND_OPENCV || + backendId == DNN_BACKEND_HALIDE || + (backendId == DNN_BACKEND_VKCOM && haveVulkan()); ++ } } bool getMemoryShapes(const std::vector &inputs, diff --cc modules/dnn/src/layers/lrn_layer.cpp index cc94329,7c85fd3..8066ef2 --- a/modules/dnn/src/layers/lrn_layer.cpp +++ b/modules/dnn/src/layers/lrn_layer.cpp @@@ -92,10 -91,8 +92,10 @@@ public virtual bool supportBackend(int backendId) CV_OVERRIDE { if (backendId == DNN_BACKEND_INFERENCE_ENGINE) - return bias == 1; + return bias == (int)bias; - return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE; + return backendId == DNN_BACKEND_OPENCV || + backendId == DNN_BACKEND_HALIDE || + (backendId == DNN_BACKEND_VKCOM && haveVulkan() && (size % 2 == 1) && (type == CHANNEL_NRM)); } #ifdef HAVE_OPENCL diff --cc modules/dnn/src/layers/pooling_layer.cpp index a89d72c,78946b4..b087cb0 --- a/modules/dnn/src/layers/pooling_layer.cpp +++ b/modules/dnn/src/layers/pooling_layer.cpp @@@ -162,11 -177,9 +178,15 @@@ public #endif } else - return (kernel_size.empty() || kernel_size.size() == 2) && (backendId == DNN_BACKEND_OPENCV || ++ { ++ if (!kernel_size.empty() && kernel_size.size() != 2) // TODO Support Pooling3D ++ return false; + return backendId == DNN_BACKEND_OPENCV || (backendId == DNN_BACKEND_HALIDE && haveHalide() && - (type == MAX || (type == AVE && !pad_t && !pad_l && !pad_b && !pad_r)))); + (type == MAX || (type == AVE && !pad_t && !pad_l && !pad_b && !pad_r))) || + (backendId == DNN_BACKEND_VKCOM && haveVulkan() && + (type == MAX || type == AVE)); ++ } } #ifdef HAVE_OPENCL