mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -122,6 +122,53 @@ String testReservedKeywordConversion(int positional_argument, int lambda = 2, in
|
||||
return format("arg=%d, lambda=%d, from=%d", positional_argument, lambda, from);
|
||||
}
|
||||
|
||||
CV_EXPORTS_W String dumpVectorOfInt(const std::vector<int>& vec);
|
||||
|
||||
CV_EXPORTS_W String dumpVectorOfDouble(const std::vector<double>& vec);
|
||||
|
||||
CV_EXPORTS_W String dumpVectorOfRect(const std::vector<Rect>& vec);
|
||||
|
||||
CV_WRAP static inline
|
||||
void generateVectorOfRect(size_t len, CV_OUT std::vector<Rect>& vec)
|
||||
{
|
||||
vec.resize(len);
|
||||
if (len > 0)
|
||||
{
|
||||
RNG rng(12345);
|
||||
Mat tmp(static_cast<int>(len), 1, CV_32SC4);
|
||||
rng.fill(tmp, RNG::UNIFORM, 10, 20);
|
||||
tmp.copyTo(vec);
|
||||
}
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
void generateVectorOfInt(size_t len, CV_OUT std::vector<int>& vec)
|
||||
{
|
||||
vec.resize(len);
|
||||
if (len > 0)
|
||||
{
|
||||
RNG rng(554433);
|
||||
Mat tmp(static_cast<int>(len), 1, CV_32SC1);
|
||||
rng.fill(tmp, RNG::UNIFORM, -10, 10);
|
||||
tmp.copyTo(vec);
|
||||
}
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
void generateVectorOfMat(size_t len, int rows, int cols, int dtype, CV_OUT std::vector<Mat>& vec)
|
||||
{
|
||||
vec.resize(len);
|
||||
if (len > 0)
|
||||
{
|
||||
RNG rng(65431);
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
{
|
||||
vec[i].create(rows, cols, dtype);
|
||||
rng.fill(vec[i], RNG::UNIFORM, 0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CV_WRAP static inline
|
||||
void testRaiseGeneralException()
|
||||
{
|
||||
|
||||
@@ -705,14 +705,47 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
* CV_NODISCARD_STD attribute (C++17) *
|
||||
* encourages the compiler to issue a warning if the return value is discarded *
|
||||
\****************************************************************************************/
|
||||
#ifndef CV_NODISCARD_STD
|
||||
# ifndef __has_cpp_attribute
|
||||
// workaround preprocessor non-compliance https://reviews.llvm.org/D57851
|
||||
# define __has_cpp_attribute(__x) 0
|
||||
# endif
|
||||
# if __has_cpp_attribute(nodiscard)
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif __cplusplus >= 201703L
|
||||
// available when compiler is C++17 compliant
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L
|
||||
// available with VS2017 v15.3+ with /std:c++17 or higher; works on functions and classes
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 700) && (__cplusplus >= 201103L)
|
||||
// available with GCC 7.0+; works on functions, works or silently fails on classes
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 408) && (__cplusplus >= 201103L)
|
||||
// available with GCC 4.8+ but it usually does nothing and can fail noisily -- therefore not used
|
||||
// define CV_NODISCARD_STD [[gnu::warn_unused_result]]
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_NODISCARD_STD
|
||||
# define CV_NODISCARD_STD /* nothing by default */
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************\
|
||||
* CV_NODISCARD attribute *
|
||||
* encourages the compiler to issue a warning if the return value is discarded (C++17) *
|
||||
* CV_NODISCARD attribute (deprecated, GCC only) *
|
||||
* DONT USE: use instead the standard CV_NODISCARD_STD macro above *
|
||||
* this legacy method silently fails to issue warning until some version *
|
||||
* after gcc 6.3.0. Yet with gcc 7+ you can use the above standard method *
|
||||
* which makes this method useless. Don't use it. *
|
||||
* @deprecated use instead CV_NODISCARD_STD *
|
||||
\****************************************************************************************/
|
||||
#ifndef CV_NODISCARD
|
||||
# if defined(__GNUC__)
|
||||
# define CV_NODISCARD __attribute__((__warn_unused_result__)) // at least available with GCC 3.4
|
||||
# define CV_NODISCARD __attribute__((__warn_unused_result__))
|
||||
# elif defined(__clang__) && defined(__has_attribute)
|
||||
# if __has_attribute(__warn_unused_result__)
|
||||
# define CV_NODISCARD __attribute__((__warn_unused_result__))
|
||||
|
||||
@@ -1188,14 +1188,14 @@ public:
|
||||
The method creates a square diagonal matrix from specified main diagonal.
|
||||
@param d One-dimensional matrix that represents the main diagonal.
|
||||
*/
|
||||
static Mat diag(const Mat& d);
|
||||
CV_NODISCARD_STD static Mat diag(const Mat& d);
|
||||
|
||||
/** @brief Creates a full copy of the array and the underlying data.
|
||||
|
||||
The method creates a full copy of the array. The original step[] is not taken into account. So, the
|
||||
array copy is a continuous array occupying total()*elemSize() bytes.
|
||||
*/
|
||||
Mat clone() const CV_NODISCARD;
|
||||
CV_NODISCARD_STD Mat clone() const;
|
||||
|
||||
/** @brief Copies the matrix to another one.
|
||||
|
||||
@@ -1359,20 +1359,20 @@ public:
|
||||
@param cols Number of columns.
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr zeros(int rows, int cols, int type);
|
||||
CV_NODISCARD_STD static MatExpr zeros(int rows, int cols, int type);
|
||||
|
||||
/** @overload
|
||||
@param size Alternative to the matrix size specification Size(cols, rows) .
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr zeros(Size size, int type);
|
||||
CV_NODISCARD_STD static MatExpr zeros(Size size, int type);
|
||||
|
||||
/** @overload
|
||||
@param ndims Array dimensionality.
|
||||
@param sz Array of integers specifying the array shape.
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr zeros(int ndims, const int* sz, int type);
|
||||
CV_NODISCARD_STD static MatExpr zeros(int ndims, const int* sz, int type);
|
||||
|
||||
/** @brief Returns an array of all 1's of the specified size and type.
|
||||
|
||||
@@ -1390,20 +1390,20 @@ public:
|
||||
@param cols Number of columns.
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr ones(int rows, int cols, int type);
|
||||
CV_NODISCARD_STD static MatExpr ones(int rows, int cols, int type);
|
||||
|
||||
/** @overload
|
||||
@param size Alternative to the matrix size specification Size(cols, rows) .
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr ones(Size size, int type);
|
||||
CV_NODISCARD_STD static MatExpr ones(Size size, int type);
|
||||
|
||||
/** @overload
|
||||
@param ndims Array dimensionality.
|
||||
@param sz Array of integers specifying the array shape.
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr ones(int ndims, const int* sz, int type);
|
||||
CV_NODISCARD_STD static MatExpr ones(int ndims, const int* sz, int type);
|
||||
|
||||
/** @brief Returns an identity matrix of the specified size and type.
|
||||
|
||||
@@ -1419,13 +1419,13 @@ public:
|
||||
@param cols Number of columns.
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr eye(int rows, int cols, int type);
|
||||
CV_NODISCARD_STD static MatExpr eye(int rows, int cols, int type);
|
||||
|
||||
/** @overload
|
||||
@param size Alternative matrix size specification as Size(cols, rows) .
|
||||
@param type Created matrix type.
|
||||
*/
|
||||
static MatExpr eye(Size size, int type);
|
||||
CV_NODISCARD_STD static MatExpr eye(Size size, int type);
|
||||
|
||||
/** @brief Allocates new array data if needed.
|
||||
|
||||
@@ -2288,7 +2288,7 @@ public:
|
||||
Mat_ row(int y) const;
|
||||
Mat_ col(int x) const;
|
||||
Mat_ diag(int d=0) const;
|
||||
Mat_ clone() const CV_NODISCARD;
|
||||
CV_NODISCARD_STD Mat_ clone() const;
|
||||
|
||||
//! overridden forms of Mat::elemSize() etc.
|
||||
size_t elemSize() const;
|
||||
@@ -2301,14 +2301,14 @@ public:
|
||||
size_t stepT(int i=0) const;
|
||||
|
||||
//! overridden forms of Mat::zeros() etc. Data type is omitted, of course
|
||||
static MatExpr zeros(int rows, int cols);
|
||||
static MatExpr zeros(Size size);
|
||||
static MatExpr zeros(int _ndims, const int* _sizes);
|
||||
static MatExpr ones(int rows, int cols);
|
||||
static MatExpr ones(Size size);
|
||||
static MatExpr ones(int _ndims, const int* _sizes);
|
||||
static MatExpr eye(int rows, int cols);
|
||||
static MatExpr eye(Size size);
|
||||
CV_NODISCARD_STD static MatExpr zeros(int rows, int cols);
|
||||
CV_NODISCARD_STD static MatExpr zeros(Size size);
|
||||
CV_NODISCARD_STD static MatExpr zeros(int _ndims, const int* _sizes);
|
||||
CV_NODISCARD_STD static MatExpr ones(int rows, int cols);
|
||||
CV_NODISCARD_STD static MatExpr ones(Size size);
|
||||
CV_NODISCARD_STD static MatExpr ones(int _ndims, const int* _sizes);
|
||||
CV_NODISCARD_STD static MatExpr eye(int rows, int cols);
|
||||
CV_NODISCARD_STD static MatExpr eye(Size size);
|
||||
|
||||
//! some more overridden methods
|
||||
Mat_& adjustROI( int dtop, int dbottom, int dleft, int dright );
|
||||
@@ -2451,11 +2451,11 @@ public:
|
||||
//! <0 - a diagonal from the lower half)
|
||||
UMat diag(int d=0) const;
|
||||
//! constructs a square diagonal matrix which main diagonal is vector "d"
|
||||
static UMat diag(const UMat& d, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat diag(const UMat& d) { return diag(d, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat diag(const UMat& d, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat diag(const UMat& d) { return diag(d, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
|
||||
//! returns deep copy of the matrix, i.e. the data is copied
|
||||
UMat clone() const CV_NODISCARD;
|
||||
CV_NODISCARD_STD UMat clone() const;
|
||||
//! copies the matrix content to "m".
|
||||
// It calls m.create(this->size(), this->type()).
|
||||
void copyTo( OutputArray m ) const;
|
||||
@@ -2486,22 +2486,22 @@ public:
|
||||
double dot(InputArray m) const;
|
||||
|
||||
//! Matlab-style matrix initialization
|
||||
static UMat zeros(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat zeros(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat zeros(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat zeros(int rows, int cols, int type) { return zeros(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat zeros(Size size, int type) { return zeros(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat zeros(int ndims, const int* sz, int type) { return zeros(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat ones(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat ones(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat ones(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat ones(int rows, int cols, int type) { return ones(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat ones(Size size, int type) { return ones(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat ones(int ndims, const int* sz, int type) { return ones(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat eye(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat eye(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
static UMat eye(int rows, int cols, int type) { return eye(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
static UMat eye(Size size, int type) { return eye(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat zeros(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat zeros(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat zeros(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat zeros(int rows, int cols, int type) { return zeros(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat zeros(Size size, int type) { return zeros(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat zeros(int ndims, const int* sz, int type) { return zeros(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat ones(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat ones(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat ones(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat ones(int rows, int cols, int type) { return ones(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat ones(Size size, int type) { return ones(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat ones(int ndims, const int* sz, int type) { return ones(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat eye(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat eye(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
|
||||
CV_NODISCARD_STD static UMat eye(int rows, int cols, int type) { return eye(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
CV_NODISCARD_STD static UMat eye(Size size, int type) { return eye(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
|
||||
|
||||
//! allocates new matrix data unless the matrix already has specified size and type.
|
||||
// previous data is unreferenced if needed.
|
||||
@@ -2767,7 +2767,7 @@ public:
|
||||
SparseMat& operator = (const Mat& m);
|
||||
|
||||
//! creates full copy of the matrix
|
||||
SparseMat clone() const CV_NODISCARD;
|
||||
CV_NODISCARD_STD SparseMat clone() const;
|
||||
|
||||
//! copies all the data to the destination matrix. All the previous content of m is erased
|
||||
void copyTo( SparseMat& m ) const;
|
||||
@@ -3004,7 +3004,7 @@ public:
|
||||
SparseMat_& operator = (const Mat& m);
|
||||
|
||||
//! makes full copy of the matrix. All the elements are duplicated
|
||||
SparseMat_ clone() const CV_NODISCARD;
|
||||
CV_NODISCARD_STD SparseMat_ clone() const;
|
||||
//! equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)
|
||||
void create(int dims, const int* _sizes);
|
||||
//! converts sparse matrix to the old-style CvSparseMat. All the elements are copied
|
||||
|
||||
@@ -142,22 +142,22 @@ public:
|
||||
|
||||
Matx(std::initializer_list<_Tp>); //!< initialize from an initializer list
|
||||
|
||||
static Matx all(_Tp alpha);
|
||||
static Matx zeros();
|
||||
static Matx ones();
|
||||
static Matx eye();
|
||||
static Matx diag(const diag_type& d);
|
||||
CV_NODISCARD_STD static Matx all(_Tp alpha);
|
||||
CV_NODISCARD_STD static Matx zeros();
|
||||
CV_NODISCARD_STD static Matx ones();
|
||||
CV_NODISCARD_STD static Matx eye();
|
||||
CV_NODISCARD_STD static Matx diag(const diag_type& d);
|
||||
/** @brief Generates uniformly distributed random numbers
|
||||
@param a Range boundary.
|
||||
@param b The other range boundary (boundaries don't have to be ordered, the lower boundary is inclusive,
|
||||
the upper one is exclusive).
|
||||
*/
|
||||
static Matx randu(_Tp a, _Tp b);
|
||||
CV_NODISCARD_STD static Matx randu(_Tp a, _Tp b);
|
||||
/** @brief Generates normally distributed random numbers
|
||||
@param a Mean value.
|
||||
@param b Standard deviation.
|
||||
*/
|
||||
static Matx randn(_Tp a, _Tp b);
|
||||
CV_NODISCARD_STD static Matx randn(_Tp a, _Tp b);
|
||||
|
||||
//! dot product computed with the default precision
|
||||
_Tp dot(const Matx<_Tp, m, n>& v) const;
|
||||
|
||||
Reference in New Issue
Block a user