mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -635,7 +635,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
*/
|
||||
GAPI_EXPORTS_W GMat addC(const GMat& src1, const GScalar& c, int ddepth = -1);
|
||||
//! @overload
|
||||
GAPI_EXPORTS GMat addC(const GScalar& c, const GMat& src1, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat addC(const GScalar& c, const GMat& src1, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the per-element difference between two matrices.
|
||||
|
||||
@@ -660,7 +660,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa add, addC
|
||||
*/
|
||||
GAPI_EXPORTS GMat sub(const GMat& src1, const GMat& src2, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat sub(const GMat& src1, const GMat& src2, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the per-element difference between matrix and given scalar.
|
||||
|
||||
@@ -679,7 +679,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa add, addC, subRC
|
||||
*/
|
||||
GAPI_EXPORTS GMat subC(const GMat& src, const GScalar& c, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat subC(const GMat& src, const GScalar& c, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the per-element difference between given scalar and the matrix.
|
||||
|
||||
@@ -698,7 +698,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa add, addC, subC
|
||||
*/
|
||||
GAPI_EXPORTS GMat subRC(const GScalar& c, const GMat& src, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat subRC(const GScalar& c, const GMat& src, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the per-element scaled product of two matrices.
|
||||
|
||||
@@ -719,7 +719,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa add, sub, div, addWeighted
|
||||
*/
|
||||
GAPI_EXPORTS GMat mul(const GMat& src1, const GMat& src2, double scale = 1.0, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat mul(const GMat& src1, const GMat& src2, double scale = 1.0, int ddepth = -1);
|
||||
|
||||
/** @brief Multiplies matrix by scalar.
|
||||
|
||||
@@ -737,11 +737,11 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix. If -1, the depth of output matrix will be the same as input matrix depth.
|
||||
@sa add, sub, div, addWeighted
|
||||
*/
|
||||
GAPI_EXPORTS GMat mulC(const GMat& src, double multiplier, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat mulC(const GMat& src, double multiplier, int ddepth = -1);
|
||||
//! @overload
|
||||
GAPI_EXPORTS GMat mulC(const GMat& src, const GScalar& multiplier, int ddepth = -1); // FIXME: merge with mulc
|
||||
GAPI_EXPORTS_W GMat mulC(const GMat& src, const GScalar& multiplier, int ddepth = -1); // FIXME: merge with mulc
|
||||
//! @overload
|
||||
GAPI_EXPORTS GMat mulC(const GScalar& multiplier, const GMat& src, int ddepth = -1); // FIXME: merge with mulc
|
||||
GAPI_EXPORTS_W GMat mulC(const GScalar& multiplier, const GMat& src, int ddepth = -1); // FIXME: merge with mulc
|
||||
|
||||
/** @brief Performs per-element division of two matrices.
|
||||
|
||||
@@ -764,7 +764,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix; you can only pass -1 when src1.depth() == src2.depth().
|
||||
@sa mul, add, sub
|
||||
*/
|
||||
GAPI_EXPORTS GMat div(const GMat& src1, const GMat& src2, double scale, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat div(const GMat& src1, const GMat& src2, double scale, int ddepth = -1);
|
||||
|
||||
/** @brief Divides matrix by scalar.
|
||||
|
||||
@@ -785,7 +785,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param scale scale factor.
|
||||
@sa add, sub, div, addWeighted
|
||||
*/
|
||||
GAPI_EXPORTS GMat divC(const GMat& src, const GScalar& divisor, double scale, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat divC(const GMat& src, const GScalar& divisor, double scale, int ddepth = -1);
|
||||
|
||||
/** @brief Divides scalar by matrix.
|
||||
|
||||
@@ -806,7 +806,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param scale scale factor
|
||||
@sa add, sub, div, addWeighted
|
||||
*/
|
||||
GAPI_EXPORTS GMat divRC(const GScalar& divident, const GMat& src, double scale, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat divRC(const GScalar& divident, const GMat& src, double scale, int ddepth = -1);
|
||||
|
||||
/** @brief Applies a mask to a matrix.
|
||||
|
||||
@@ -819,7 +819,7 @@ Supported src matrix data types are @ref CV_8UC1, @ref CV_16SC1, @ref CV_16UC1.
|
||||
@param src input matrix.
|
||||
@param mask input mask matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat mask(const GMat& src, const GMat& mask);
|
||||
GAPI_EXPORTS_W GMat mask(const GMat& src, const GMat& mask);
|
||||
|
||||
/** @brief Calculates an average (mean) of matrix elements.
|
||||
|
||||
@@ -854,8 +854,8 @@ Both output must have the same size and depth as input matrices.
|
||||
degrees, otherwise, they are measured in radians.
|
||||
@sa cartToPolar, exp, log, pow, sqrt
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GMat, GMat> polarToCart(const GMat& magnitude, const GMat& angle,
|
||||
bool angleInDegrees = false);
|
||||
GAPI_EXPORTS_W std::tuple<GMat, GMat> polarToCart(const GMat& magnitude, const GMat& angle,
|
||||
bool angleInDegrees = false);
|
||||
|
||||
/** @brief Calculates the magnitude and angle of 2D vectors.
|
||||
|
||||
@@ -878,8 +878,8 @@ x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360
|
||||
in radians (which is by default), or in degrees.
|
||||
@sa polarToCart
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GMat, GMat> cartToPolar(const GMat& x, const GMat& y,
|
||||
bool angleInDegrees = false);
|
||||
GAPI_EXPORTS_W std::tuple<GMat, GMat> cartToPolar(const GMat& x, const GMat& y,
|
||||
bool angleInDegrees = false);
|
||||
|
||||
/** @brief Calculates the rotation angle of 2D vectors.
|
||||
|
||||
@@ -896,7 +896,7 @@ same size and the same type as x.
|
||||
degrees, otherwise, they are measured in radians.
|
||||
@return array of vector angles; it has the same size and same type as x.
|
||||
*/
|
||||
GAPI_EXPORTS GMat phase(const GMat& x, const GMat &y, bool angleInDegrees = false);
|
||||
GAPI_EXPORTS_W GMat phase(const GMat& x, const GMat &y, bool angleInDegrees = false);
|
||||
|
||||
/** @brief Calculates a square root of array elements.
|
||||
|
||||
@@ -907,7 +907,7 @@ std::sqrt .
|
||||
@param src input floating-point array.
|
||||
@return output array of the same size and type as src.
|
||||
*/
|
||||
GAPI_EXPORTS GMat sqrt(const GMat &src);
|
||||
GAPI_EXPORTS_W GMat sqrt(const GMat &src);
|
||||
|
||||
//! @} gapi_math
|
||||
//!
|
||||
@@ -934,11 +934,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_16UC1, @ref CV_16SC1
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpLE, cmpGE, cmpLT
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpGT(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpGT(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpGTScalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpGT(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpGT(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief Performs the per-element comparison of two matrices checking if elements from first matrix are less than elements in second.
|
||||
|
||||
@@ -960,11 +960,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpLE, cmpGE, cmpGT
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpLT(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpLT(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpLTScalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpLT(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpLT(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief Performs the per-element comparison of two matrices checking if elements from first matrix are greater or equal compare to elements in second.
|
||||
|
||||
@@ -986,11 +986,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpLE, cmpGT, cmpLT
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpGE(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpGE(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpLGEcalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpGE(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpGE(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief Performs the per-element comparison of two matrices checking if elements from first matrix are less or equal compare to elements in second.
|
||||
|
||||
@@ -1012,11 +1012,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpGT, cmpGE, cmpLT
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpLE(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpLE(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpLEScalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpLE(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpLE(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief Performs the per-element comparison of two matrices checking if elements from first matrix are equal to elements in second.
|
||||
|
||||
@@ -1038,11 +1038,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpNE
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpEQ(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpEQ(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpEQScalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpEQ(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpEQ(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief Performs the per-element comparison of two matrices checking if elements from first matrix are not equal to elements in second.
|
||||
|
||||
@@ -1064,11 +1064,11 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix/scalar of the same depth as first input matrix.
|
||||
@sa min, max, threshold, cmpEQ
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpNE(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat cmpNE(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.compare.cmpNEScalar"
|
||||
*/
|
||||
GAPI_EXPORTS GMat cmpNE(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat cmpNE(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief computes bitwise conjunction of the two matrixes (src1 & src2)
|
||||
Calculates the per-element bit-wise logical conjunction of two matrices of the same size.
|
||||
@@ -1086,13 +1086,13 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src1 first input matrix.
|
||||
@param src2 second input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_and(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_and(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.bitwise_andS"
|
||||
@param src1 first input matrix.
|
||||
@param src2 scalar, which will be per-lemenetly conjuncted with elements of src1.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_and(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_and(const GMat& src1, const GScalar& src2);
|
||||
|
||||
/** @brief computes bitwise disjunction of the two matrixes (src1 | src2)
|
||||
Calculates the per-element bit-wise logical disjunction of two matrices of the same size.
|
||||
@@ -1110,13 +1110,13 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src1 first input matrix.
|
||||
@param src2 second input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_or(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_or(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.bitwise_orS"
|
||||
@param src1 first input matrix.
|
||||
@param src2 scalar, which will be per-lemenetly disjuncted with elements of src1.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_or(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_or(const GMat& src1, const GScalar& src2);
|
||||
|
||||
|
||||
/** @brief computes bitwise logical "exclusive or" of the two matrixes (src1 ^ src2)
|
||||
@@ -1135,13 +1135,13 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src1 first input matrix.
|
||||
@param src2 second input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_xor(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_xor(const GMat& src1, const GMat& src2);
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.pixelwise.bitwise_xorS"
|
||||
@param src1 first input matrix.
|
||||
@param src2 scalar, for which per-lemenet "logical or" operation on elements of src1 will be performed.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_xor(const GMat& src1, const GScalar& src2);
|
||||
GAPI_EXPORTS_W GMat bitwise_xor(const GMat& src1, const GScalar& src2);
|
||||
|
||||
|
||||
/** @brief Inverts every bit of an array.
|
||||
@@ -1162,7 +1162,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
|
||||
@param src input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bitwise_not(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat bitwise_not(const GMat& src);
|
||||
|
||||
/** @brief Select values from either first or second of input matrices by given mask.
|
||||
The function set to the output matrix either the value from the first input matrix if corresponding value of mask matrix is 255,
|
||||
@@ -1178,7 +1178,7 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix.
|
||||
@param mask mask input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat select(const GMat& src1, const GMat& src2, const GMat& mask);
|
||||
GAPI_EXPORTS_W GMat select(const GMat& src1, const GMat& src2, const GMat& mask);
|
||||
|
||||
//! @} gapi_pixelwise
|
||||
|
||||
@@ -1200,7 +1200,7 @@ Supported input matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1,
|
||||
@param src2 second input matrix of the same size and depth as src1.
|
||||
@sa max, cmpEQ, cmpLT, cmpLE
|
||||
*/
|
||||
GAPI_EXPORTS GMat min(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat min(const GMat& src1, const GMat& src2);
|
||||
|
||||
/** @brief Calculates per-element maximum of two matrices.
|
||||
|
||||
@@ -1217,7 +1217,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src2 second input matrix of the same size and depth as src1.
|
||||
@sa min, compare, cmpEQ, cmpGT, cmpGE
|
||||
*/
|
||||
GAPI_EXPORTS GMat max(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat max(const GMat& src1, const GMat& src2);
|
||||
|
||||
/** @brief Calculates the per-element absolute difference between two matrices.
|
||||
|
||||
@@ -1234,7 +1234,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src2 second input matrix.
|
||||
@sa abs
|
||||
*/
|
||||
GAPI_EXPORTS GMat absDiff(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat absDiff(const GMat& src1, const GMat& src2);
|
||||
|
||||
/** @brief Calculates absolute value of matrix elements.
|
||||
|
||||
@@ -1251,7 +1251,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param c scalar to be subtracted.
|
||||
@sa min, max
|
||||
*/
|
||||
GAPI_EXPORTS GMat absDiffC(const GMat& src, const GScalar& c);
|
||||
GAPI_EXPORTS_W GMat absDiffC(const GMat& src, const GScalar& c);
|
||||
|
||||
/** @brief Calculates sum of all matrix elements.
|
||||
|
||||
@@ -1263,7 +1263,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src input matrix.
|
||||
@sa countNonZero, mean, min, max
|
||||
*/
|
||||
GAPI_EXPORTS GScalar sum(const GMat& src);
|
||||
GAPI_EXPORTS_W GScalar sum(const GMat& src);
|
||||
|
||||
/** @brief Counts non-zero array elements.
|
||||
|
||||
@@ -1276,7 +1276,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_16UC1, @ref CV_16SC1, @ref
|
||||
@param src input single-channel matrix.
|
||||
@sa mean, min, max
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<int> countNonZero(const GMat& src);
|
||||
GAPI_EXPORTS_W GOpaque<int> countNonZero(const GMat& src);
|
||||
|
||||
/** @brief Calculates the weighted sum of two matrices.
|
||||
|
||||
@@ -1299,7 +1299,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa add, sub
|
||||
*/
|
||||
GAPI_EXPORTS GMat addWeighted(const GMat& src1, double alpha, const GMat& src2, double beta, double gamma, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat addWeighted(const GMat& src1, double alpha, const GMat& src2, double beta, double gamma, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the absolute L1 norm of a matrix.
|
||||
|
||||
@@ -1322,7 +1322,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src input matrix.
|
||||
@sa normL2, normInf
|
||||
*/
|
||||
GAPI_EXPORTS GScalar normL1(const GMat& src);
|
||||
GAPI_EXPORTS_W GScalar normL1(const GMat& src);
|
||||
|
||||
/** @brief Calculates the absolute L2 norm of a matrix.
|
||||
|
||||
@@ -1344,7 +1344,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src input matrix.
|
||||
@sa normL1, normInf
|
||||
*/
|
||||
GAPI_EXPORTS GScalar normL2(const GMat& src);
|
||||
GAPI_EXPORTS_W GScalar normL2(const GMat& src);
|
||||
|
||||
/** @brief Calculates the absolute infinite norm of a matrix.
|
||||
|
||||
@@ -1367,7 +1367,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src input matrix.
|
||||
@sa normL1, normL2
|
||||
*/
|
||||
GAPI_EXPORTS GScalar normInf(const GMat& src);
|
||||
GAPI_EXPORTS_W GScalar normInf(const GMat& src);
|
||||
|
||||
/** @brief Calculates the integral of an image.
|
||||
|
||||
@@ -1387,7 +1387,7 @@ The function return integral image as \f$(W+1)\times (H+1)\f$ , 32-bit integer o
|
||||
CV_64F.
|
||||
@param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GMat, GMat> integral(const GMat& src, int sdepth = -1, int sqdepth = -1);
|
||||
GAPI_EXPORTS_W std::tuple<GMat, GMat> integral(const GMat& src, int sdepth = -1, int sqdepth = -1);
|
||||
|
||||
/** @brief Applies a fixed-level threshold to each matrix element.
|
||||
|
||||
@@ -1416,7 +1416,7 @@ types.
|
||||
|
||||
@sa min, max, cmpGT, cmpLE, cmpGE, cmpLT
|
||||
*/
|
||||
GAPI_EXPORTS GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int type);
|
||||
GAPI_EXPORTS_W GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int type);
|
||||
/** @overload
|
||||
This function applicable for all threshold types except cv::THRESH_OTSU and cv::THRESH_TRIANGLE
|
||||
@note Function textual ID is "org.opencv.core.matrixop.thresholdOT"
|
||||
@@ -1438,7 +1438,7 @@ Input and output matrices must be CV_8UC1.
|
||||
|
||||
@sa threshold
|
||||
*/
|
||||
GAPI_EXPORTS GMat inRange(const GMat& src, const GScalar& threshLow, const GScalar& threshUp);
|
||||
GAPI_EXPORTS_W GMat inRange(const GMat& src, const GScalar& threshLow, const GScalar& threshUp);
|
||||
|
||||
//! @} gapi_matrixop
|
||||
|
||||
@@ -1462,7 +1462,7 @@ The function split4 does the reverse operation.
|
||||
@param src4 fourth input @ref CV_8UC1 matrix to be merged.
|
||||
@sa merge3, split4, split3
|
||||
*/
|
||||
GAPI_EXPORTS GMat merge4(const GMat& src1, const GMat& src2, const GMat& src3, const GMat& src4);
|
||||
GAPI_EXPORTS_W GMat merge4(const GMat& src1, const GMat& src2, const GMat& src3, const GMat& src4);
|
||||
|
||||
/** @brief Creates one 3-channel matrix out of 3 single-channel ones.
|
||||
|
||||
@@ -1481,7 +1481,7 @@ The function split3 does the reverse operation.
|
||||
@param src3 third input @ref CV_8UC1 matrix to be merged.
|
||||
@sa merge4, split4, split3
|
||||
*/
|
||||
GAPI_EXPORTS GMat merge3(const GMat& src1, const GMat& src2, const GMat& src3);
|
||||
GAPI_EXPORTS_W GMat merge3(const GMat& src1, const GMat& src2, const GMat& src3);
|
||||
|
||||
/** @brief Divides a 4-channel matrix into 4 single-channel matrices.
|
||||
|
||||
@@ -1498,7 +1498,7 @@ The function merge4 does the reverse operation.
|
||||
@param src input @ref CV_8UC4 matrix.
|
||||
@sa split3, merge3, merge4
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GMat, GMat, GMat,GMat> split4(const GMat& src);
|
||||
GAPI_EXPORTS_W std::tuple<GMat, GMat, GMat,GMat> split4(const GMat& src);
|
||||
|
||||
/** @brief Divides a 3-channel matrix into 3 single-channel matrices.
|
||||
|
||||
@@ -1548,9 +1548,9 @@ borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image
|
||||
corresponds to the "outliers" in the source image are not modified by the function.
|
||||
@param borderValue Value used in case of a constant border. By default, it is 0.
|
||||
*/
|
||||
GAPI_EXPORTS GMat remap(const GMat& src, const Mat& map1, const Mat& map2,
|
||||
int interpolation, int borderMode = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = Scalar());
|
||||
GAPI_EXPORTS_W GMat remap(const GMat& src, const Mat& map1, const Mat& map2,
|
||||
int interpolation, int borderMode = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = Scalar());
|
||||
|
||||
/** @brief Flips a 2D matrix around vertical, horizontal, or both axes.
|
||||
|
||||
@@ -1587,7 +1587,7 @@ flipping around y-axis. Negative value (for example, -1) means flipping
|
||||
around both axes.
|
||||
@sa remap
|
||||
*/
|
||||
GAPI_EXPORTS GMat flip(const GMat& src, int flipCode);
|
||||
GAPI_EXPORTS_W GMat flip(const GMat& src, int flipCode);
|
||||
|
||||
/** @brief Crops a 2D matrix.
|
||||
|
||||
@@ -1601,7 +1601,7 @@ Output matrix must be of the same depth as input one, size is specified by given
|
||||
@param rect a rect to crop a matrix to
|
||||
@sa resize
|
||||
*/
|
||||
GAPI_EXPORTS GMat crop(const GMat& src, const Rect& rect);
|
||||
GAPI_EXPORTS_W GMat crop(const GMat& src, const Rect& rect);
|
||||
|
||||
/** @brief Applies horizontal concatenation to given matrices.
|
||||
|
||||
@@ -1629,7 +1629,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src2 second input matrix to be considered for horizontal concatenation.
|
||||
@sa concatVert
|
||||
*/
|
||||
GAPI_EXPORTS GMat concatHor(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat concatHor(const GMat& src1, const GMat& src2);
|
||||
|
||||
/** @overload
|
||||
The function horizontally concatenates given number of GMat matrices (with the same number of columns).
|
||||
@@ -1637,7 +1637,7 @@ Output matrix must the same number of columns and depth as the input matrices, a
|
||||
|
||||
@param v vector of input matrices to be concatenated horizontally.
|
||||
*/
|
||||
GAPI_EXPORTS GMat concatHor(const std::vector<GMat> &v);
|
||||
GAPI_EXPORTS_W GMat concatHor(const std::vector<GMat> &v);
|
||||
|
||||
/** @brief Applies vertical concatenation to given matrices.
|
||||
|
||||
@@ -1669,7 +1669,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param src2 second input matrix to be considered for vertical concatenation.
|
||||
@sa concatHor
|
||||
*/
|
||||
GAPI_EXPORTS GMat concatVert(const GMat& src1, const GMat& src2);
|
||||
GAPI_EXPORTS_W GMat concatVert(const GMat& src1, const GMat& src2);
|
||||
|
||||
/** @overload
|
||||
The function vertically concatenates given number of GMat matrices (with the same number of columns).
|
||||
@@ -1677,7 +1677,7 @@ Output matrix must the same number of columns and depth as the input matrices, a
|
||||
|
||||
@param v vector of input matrices to be concatenated vertically.
|
||||
*/
|
||||
GAPI_EXPORTS GMat concatVert(const std::vector<GMat> &v);
|
||||
GAPI_EXPORTS_W GMat concatVert(const std::vector<GMat> &v);
|
||||
|
||||
|
||||
/** @brief Performs a look-up table transform of a matrix.
|
||||
@@ -1696,7 +1696,7 @@ Output is a matrix of the same size and number of channels as src, and the same
|
||||
either have a single channel (in this case the same table is used for all channels) or the same
|
||||
number of channels as in the input matrix.
|
||||
*/
|
||||
GAPI_EXPORTS GMat LUT(const GMat& src, const Mat& lut);
|
||||
GAPI_EXPORTS_W GMat LUT(const GMat& src, const Mat& lut);
|
||||
|
||||
/** @brief Converts a matrix to another data depth with optional scaling.
|
||||
|
||||
@@ -1713,7 +1713,7 @@ same as the input has; if rdepth is negative, the output matrix will have the sa
|
||||
@param alpha optional scale factor.
|
||||
@param beta optional delta added to the scaled values.
|
||||
*/
|
||||
GAPI_EXPORTS GMat convertTo(const GMat& src, int rdepth, double alpha=1, double beta=0);
|
||||
GAPI_EXPORTS_W GMat convertTo(const GMat& src, int rdepth, double alpha=1, double beta=0);
|
||||
|
||||
/** @brief Normalizes the norm or value range of an array.
|
||||
|
||||
@@ -1735,8 +1735,8 @@ normalization.
|
||||
number of channels as src and the depth =ddepth.
|
||||
@sa norm, Mat::convertTo
|
||||
*/
|
||||
GAPI_EXPORTS GMat normalize(const GMat& src, double alpha, double beta,
|
||||
int norm_type, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat normalize(const GMat& src, double alpha, double beta,
|
||||
int norm_type, int ddepth = -1);
|
||||
|
||||
/** @brief Applies a perspective transformation to an image.
|
||||
|
||||
@@ -1759,8 +1759,8 @@ optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
|
||||
|
||||
@sa warpAffine, resize, remap, getRectSubPix, perspectiveTransform
|
||||
*/
|
||||
GAPI_EXPORTS GMat warpPerspective(const GMat& src, const Mat& M, const Size& dsize, int flags = cv::INTER_LINEAR,
|
||||
int borderMode = cv::BORDER_CONSTANT, const Scalar& borderValue = Scalar());
|
||||
GAPI_EXPORTS_W GMat warpPerspective(const GMat& src, const Mat& M, const Size& dsize, int flags = cv::INTER_LINEAR,
|
||||
int borderMode = cv::BORDER_CONSTANT, const Scalar& borderValue = Scalar());
|
||||
|
||||
/** @brief Applies an affine transformation to an image.
|
||||
|
||||
@@ -1784,8 +1784,8 @@ borderMode=#BORDER_TRANSPARENT isn't supported
|
||||
|
||||
@sa warpPerspective, resize, remap, getRectSubPix, transform
|
||||
*/
|
||||
GAPI_EXPORTS GMat warpAffine(const GMat& src, const Mat& M, const Size& dsize, int flags = cv::INTER_LINEAR,
|
||||
int borderMode = cv::BORDER_CONSTANT, const Scalar& borderValue = Scalar());
|
||||
GAPI_EXPORTS_W GMat warpAffine(const GMat& src, const Mat& M, const Size& dsize, int flags = cv::INTER_LINEAR,
|
||||
int borderMode = cv::BORDER_CONSTANT, const Scalar& borderValue = Scalar());
|
||||
//! @} gapi_transform
|
||||
|
||||
/** @brief Finds centers of clusters and groups input samples around the clusters.
|
||||
@@ -1834,7 +1834,7 @@ compactness value are returned by the function.
|
||||
- Integer array that stores the cluster indices for every sample.
|
||||
- Array of the cluster centers.
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GOpaque<double>,GMat,GMat>
|
||||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GMat,GMat>
|
||||
kmeans(const GMat& data, const int K, const GMat& bestLabels,
|
||||
const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
|
||||
|
||||
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels,
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.kmeans3D"
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
|
||||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
|
||||
kmeans(const GArray<Point3f>& data, const int K, const GArray<int>& bestLabels,
|
||||
const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
|
||||
|
||||
@@ -1873,7 +1873,7 @@ The function transposes the matrix:
|
||||
|
||||
@param src input array.
|
||||
*/
|
||||
GAPI_EXPORTS GMat transpose(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat transpose(const GMat& src);
|
||||
|
||||
|
||||
namespace streaming {
|
||||
@@ -1903,7 +1903,7 @@ GAPI_EXPORTS_W GOpaque<Size> size(const GOpaque<Rect>& r);
|
||||
@param src Input frame
|
||||
@return Size (frame dimensions).
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Size> size(const GFrame& src);
|
||||
GAPI_EXPORTS_W GOpaque<Size> size(const GFrame& src);
|
||||
} //namespace streaming
|
||||
} //namespace gapi
|
||||
} //namespace cv
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#ifndef OPENCV_GAPI_GCPUKERNEL_HPP
|
||||
#define OPENCV_GAPI_GCPUKERNEL_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4702) // "Unreachable code"
|
||||
// on postprocess(...) call inside OCVCallHelper
|
||||
#if defined _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4702) // "Unreachable code" on postprocess(...) call inside OCVCallHelper
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
@@ -535,4 +535,8 @@ gapi::cpu::GOCVFunctor gapi::cpu::ocv_kernel(const Callable& c)
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#if defined _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // OPENCV_GAPI_GCPUKERNEL_HPP
|
||||
|
||||
@@ -248,11 +248,11 @@ struct scratch_helper<false, Impl, Ins...>
|
||||
const cv::GArgs &,
|
||||
gapi::fluid::Buffer &)
|
||||
{
|
||||
GAPI_Assert(false);
|
||||
GAPI_Error("InternalError");
|
||||
}
|
||||
static void help_reset(gapi::fluid::Buffer &)
|
||||
{
|
||||
GAPI_Assert(false);
|
||||
GAPI_Error("InternalError");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace detail
|
||||
{
|
||||
util::get<rw_own_t>(m_ref).clear();
|
||||
}
|
||||
else GAPI_Assert(false); // shouldn't be called in *EXT modes
|
||||
else GAPI_Error("InternalError"); // shouldn't be called in *EXT modes
|
||||
}
|
||||
|
||||
// Obtain a WRITE reference to underlying object
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace detail
|
||||
CV_STRING, // std::string user G-API data
|
||||
CV_POINT, // cv::Point user G-API data
|
||||
CV_POINT2F, // cv::Point2f user G-API data
|
||||
CV_POINT3F, // cv::Point3f user G-API data
|
||||
CV_SIZE, // cv::Size user G-API data
|
||||
CV_RECT, // cv::Rect user G-API data
|
||||
CV_SCALAR, // cv::Scalar user G-API data
|
||||
@@ -72,16 +73,17 @@ namespace detail
|
||||
template<> struct GOpaqueTraits<cv::Scalar> { static constexpr const OpaqueKind kind = OpaqueKind::CV_SCALAR; };
|
||||
template<> struct GOpaqueTraits<cv::Point> { static constexpr const OpaqueKind kind = OpaqueKind::CV_POINT; };
|
||||
template<> struct GOpaqueTraits<cv::Point2f> { static constexpr const OpaqueKind kind = OpaqueKind::CV_POINT2F; };
|
||||
template<> struct GOpaqueTraits<cv::Point3f> { static constexpr const OpaqueKind kind = OpaqueKind::CV_POINT3F; };
|
||||
template<> struct GOpaqueTraits<cv::Mat> { static constexpr const OpaqueKind kind = OpaqueKind::CV_MAT; };
|
||||
template<> struct GOpaqueTraits<cv::Rect> { static constexpr const OpaqueKind kind = OpaqueKind::CV_RECT; };
|
||||
template<> struct GOpaqueTraits<cv::GMat> { static constexpr const OpaqueKind kind = OpaqueKind::CV_MAT; };
|
||||
template<> struct GOpaqueTraits<cv::gapi::wip::draw::Prim>
|
||||
{ static constexpr const OpaqueKind kind = OpaqueKind::CV_DRAW_PRIM; };
|
||||
using GOpaqueTraitsArrayTypes = std::tuple<int, double, float, uint64_t, bool, std::string, cv::Size, cv::Scalar, cv::Point, cv::Point2f,
|
||||
cv::Mat, cv::Rect, cv::gapi::wip::draw::Prim>;
|
||||
cv::Point3f, cv::Mat, cv::Rect, cv::gapi::wip::draw::Prim>;
|
||||
// GOpaque is not supporting cv::Mat and cv::Scalar since there are GScalar and GMat types
|
||||
using GOpaqueTraitsOpaqueTypes = std::tuple<int, double, float, uint64_t, bool, std::string, cv::Size, cv::Point, cv::Point2f, cv::Rect,
|
||||
cv::gapi::wip::draw::Prim>;
|
||||
using GOpaqueTraitsOpaqueTypes = std::tuple<int, double, float, uint64_t, bool, std::string, cv::Size, cv::Point, cv::Point2f, cv::Point3f,
|
||||
cv::Rect, cv::gapi::wip::draw::Prim>;
|
||||
} // namespace detail
|
||||
|
||||
// This definition is here because it is reused by both public(?) and internal
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace detail
|
||||
{
|
||||
util::get<rw_own_t>(m_ref) = {};
|
||||
}
|
||||
else GAPI_Assert(false); // shouldn't be called in *EXT modes
|
||||
else GAPI_Error("InternalError"); // shouldn't be called in *EXT modes
|
||||
}
|
||||
|
||||
// Obtain a WRITE reference to underlying object
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
*
|
||||
* @param s a cv::Scalar value to associate with this GScalar object.
|
||||
*/
|
||||
GAPI_WRAP
|
||||
explicit GScalar(const cv::Scalar& s);
|
||||
|
||||
/**
|
||||
|
||||
@@ -556,9 +556,9 @@ is at the kernel center.
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa boxFilter, gaussianBlur, medianBlur
|
||||
*/
|
||||
GAPI_EXPORTS GMat sepFilter(const GMat& src, int ddepth, const Mat& kernelX, const Mat& kernelY, const Point& anchor /*FIXME: = Point(-1,-1)*/,
|
||||
const Scalar& delta /*FIXME = GScalar(0)*/, int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat sepFilter(const GMat& src, int ddepth, const Mat& kernelX, const Mat& kernelY, const Point& anchor /*FIXME: = Point(-1,-1)*/,
|
||||
const Scalar& delta /*FIXME = GScalar(0)*/, int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
|
||||
/** @brief Convolves an image with the kernel.
|
||||
|
||||
@@ -593,8 +593,8 @@ is at the kernel center.
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa sepFilter
|
||||
*/
|
||||
GAPI_EXPORTS GMat filter2D(const GMat& src, int ddepth, const Mat& kernel, const Point& anchor = Point(-1,-1), const Scalar& delta = Scalar(0),
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat filter2D(const GMat& src, int ddepth, const Mat& kernel, const Point& anchor = Point(-1,-1), const Scalar& delta = Scalar(0),
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
|
||||
|
||||
/** @brief Blurs an image using the box filter.
|
||||
@@ -627,9 +627,9 @@ is at the kernel center.
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa sepFilter, gaussianBlur, medianBlur, integral
|
||||
*/
|
||||
GAPI_EXPORTS GMat boxFilter(const GMat& src, int dtype, const Size& ksize, const Point& anchor = Point(-1,-1),
|
||||
bool normalize = true, int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat boxFilter(const GMat& src, int dtype, const Size& ksize, const Point& anchor = Point(-1,-1),
|
||||
bool normalize = true, int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
|
||||
/** @brief Blurs an image using the normalized box filter.
|
||||
|
||||
@@ -654,8 +654,8 @@ center.
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur
|
||||
*/
|
||||
GAPI_EXPORTS GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1),
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1),
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
|
||||
|
||||
//GAPI_EXPORTS_W void blur( InputArray src, OutputArray dst,
|
||||
@@ -687,8 +687,8 @@ sigmaX, and sigmaY.
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa sepFilter, boxFilter, medianBlur
|
||||
*/
|
||||
GAPI_EXPORTS GMat gaussianBlur(const GMat& src, const Size& ksize, double sigmaX, double sigmaY = 0,
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat gaussianBlur(const GMat& src, const Size& ksize, double sigmaX, double sigmaY = 0,
|
||||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
|
||||
|
||||
/** @brief Blurs an image using the median filter.
|
||||
|
||||
@@ -730,9 +730,9 @@ anchor is at the element center.
|
||||
@param borderValue border value in case of a constant border
|
||||
@sa dilate, morphologyEx
|
||||
*/
|
||||
GAPI_EXPORTS GMat erode(const GMat& src, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
GAPI_EXPORTS_W GMat erode(const GMat& src, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief Erodes an image by using 3 by 3 rectangular structuring element.
|
||||
|
||||
@@ -750,9 +750,9 @@ Output image must have the same type, size, and number of channels as the input
|
||||
@param borderValue border value in case of a constant border
|
||||
@sa erode, dilate3x3
|
||||
*/
|
||||
GAPI_EXPORTS GMat erode3x3(const GMat& src, int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
GAPI_EXPORTS_W GMat erode3x3(const GMat& src, int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief Dilates an image by using a specific structuring element.
|
||||
|
||||
@@ -777,9 +777,9 @@ anchor is at the element center.
|
||||
@param borderValue border value in case of a constant border
|
||||
@sa erode, morphologyEx, getStructuringElement
|
||||
*/
|
||||
GAPI_EXPORTS GMat dilate(const GMat& src, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
GAPI_EXPORTS_W GMat dilate(const GMat& src, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief Dilates an image by using 3 by 3 rectangular structuring element.
|
||||
|
||||
@@ -801,9 +801,9 @@ Output image must have the same type, size, and number of channels as the input
|
||||
@sa dilate, erode3x3
|
||||
*/
|
||||
|
||||
GAPI_EXPORTS GMat dilate3x3(const GMat& src, int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
GAPI_EXPORTS_W GMat dilate3x3(const GMat& src, int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief Performs advanced morphological transformations.
|
||||
|
||||
@@ -831,11 +831,11 @@ the kernel center.
|
||||
meaning.
|
||||
@sa dilate, erode, getStructuringElement
|
||||
*/
|
||||
GAPI_EXPORTS GMat morphologyEx(const GMat &src, const MorphTypes op, const Mat &kernel,
|
||||
const Point &anchor = Point(-1,-1),
|
||||
const int iterations = 1,
|
||||
const BorderTypes borderType = BORDER_CONSTANT,
|
||||
const Scalar &borderValue = morphologyDefaultBorderValue());
|
||||
GAPI_EXPORTS_W GMat morphologyEx(const GMat &src, const MorphTypes op, const Mat &kernel,
|
||||
const Point &anchor = Point(-1,-1),
|
||||
const int iterations = 1,
|
||||
const BorderTypes borderType = BORDER_CONSTANT,
|
||||
const Scalar &borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
||||
|
||||
@@ -883,10 +883,10 @@ applied (see cv::getDerivKernels for details).
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa filter2D, gaussianBlur, cartToPolar
|
||||
*/
|
||||
GAPI_EXPORTS GMat Sobel(const GMat& src, int ddepth, int dx, int dy, int ksize = 3,
|
||||
double scale = 1, double delta = 0,
|
||||
int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W GMat Sobel(const GMat& src, int ddepth, int dx, int dy, int ksize = 3,
|
||||
double scale = 1, double delta = 0,
|
||||
int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
|
||||
/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
||||
|
||||
@@ -934,10 +934,10 @@ applied (see cv::getDerivKernels for details).
|
||||
@param borderValue border value in case of constant border type
|
||||
@sa filter2D, gaussianBlur, cartToPolar
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GMat, GMat> SobelXY(const GMat& src, int ddepth, int order, int ksize = 3,
|
||||
double scale = 1, double delta = 0,
|
||||
int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
GAPI_EXPORTS_W std::tuple<GMat, GMat> SobelXY(const GMat& src, int ddepth, int order, int ksize = 3,
|
||||
double scale = 1, double delta = 0,
|
||||
int borderType = BORDER_DEFAULT,
|
||||
const Scalar& borderValue = Scalar(0));
|
||||
|
||||
/** @brief Calculates the Laplacian of an image.
|
||||
|
||||
@@ -964,8 +964,8 @@ applied. See #getDerivKernels for details.
|
||||
@return Destination image of the same size and the same number of channels as src.
|
||||
@sa Sobel, Scharr
|
||||
*/
|
||||
GAPI_EXPORTS GMat Laplacian(const GMat& src, int ddepth, int ksize = 1,
|
||||
double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT);
|
||||
GAPI_EXPORTS_W GMat Laplacian(const GMat& src, int ddepth, int ksize = 1,
|
||||
double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT);
|
||||
|
||||
/** @brief Applies the bilateral filter to an image.
|
||||
|
||||
@@ -998,8 +998,8 @@ proportional to sigmaSpace.
|
||||
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
|
||||
@return Destination image of the same size and type as src.
|
||||
*/
|
||||
GAPI_EXPORTS GMat bilateralFilter(const GMat& src, int d, double sigmaColor, double sigmaSpace,
|
||||
int borderType = BORDER_DEFAULT);
|
||||
GAPI_EXPORTS_W GMat bilateralFilter(const GMat& src, int d, double sigmaColor, double sigmaSpace,
|
||||
int borderType = BORDER_DEFAULT);
|
||||
|
||||
//! @} gapi_filters
|
||||
|
||||
@@ -1023,8 +1023,8 @@ largest value is used to find initial segments of strong edges. See
|
||||
L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough (
|
||||
L2gradient=false ).
|
||||
*/
|
||||
GAPI_EXPORTS GMat Canny(const GMat& image, double threshold1, double threshold2,
|
||||
int apertureSize = 3, bool L2gradient = false);
|
||||
GAPI_EXPORTS_W GMat Canny(const GMat& image, double threshold1, double threshold2,
|
||||
int apertureSize = 3, bool L2gradient = false);
|
||||
|
||||
/** @brief Determines strong corners on an image.
|
||||
|
||||
@@ -1070,14 +1070,14 @@ or #cornerMinEigenVal.
|
||||
|
||||
@return vector of detected corners.
|
||||
*/
|
||||
GAPI_EXPORTS_W GArray<Point2f> goodFeaturesToTrack(const GMat &image,
|
||||
int maxCorners,
|
||||
double qualityLevel,
|
||||
double minDistance,
|
||||
const Mat &mask = Mat(),
|
||||
int blockSize = 3,
|
||||
bool useHarrisDetector = false,
|
||||
double k = 0.04);
|
||||
GAPI_EXPORTS_W GArray<Point2f> goodFeaturesToTrack(const GMat &image,
|
||||
int maxCorners,
|
||||
double qualityLevel,
|
||||
double minDistance,
|
||||
const Mat &mask = Mat(),
|
||||
int blockSize = 3,
|
||||
bool useHarrisDetector = false,
|
||||
double k = 0.04);
|
||||
|
||||
/** @brief Equalizes the histogram of a grayscale image.
|
||||
|
||||
@@ -1098,7 +1098,7 @@ The algorithm normalizes the brightness and increases the contrast of the image.
|
||||
|
||||
@param src Source 8-bit single channel image.
|
||||
*/
|
||||
GAPI_EXPORTS GMat equalizeHist(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat equalizeHist(const GMat& src);
|
||||
|
||||
//! @addtogroup gapi_shape
|
||||
//! @{
|
||||
@@ -1209,7 +1209,7 @@ Calculates the up-right bounding rectangle of a point set.
|
||||
|
||||
@param src Input 2D point set, stored in std::vector<cv::Point2f>.
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Rect> boundingRect(const GArray<Point2f>& src);
|
||||
GAPI_EXPORTS_W GOpaque<Rect> boundingRect(const GArray<Point2f>& src);
|
||||
|
||||
/** @brief Fits a line to a 2D point set.
|
||||
|
||||
@@ -1399,7 +1399,7 @@ Resulting gray color value computed as
|
||||
@param bY float multiplier for B channel.
|
||||
@sa RGB2YUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2Gray(const GMat& src, float rY, float gY, float bY);
|
||||
GAPI_EXPORTS_W GMat RGB2Gray(const GMat& src, float rY, float gY, float bY);
|
||||
|
||||
/** @brief Converts an image from BGR color space to gray-scaled.
|
||||
|
||||
@@ -1412,7 +1412,7 @@ Resulting gray color value computed as
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC1.
|
||||
@sa BGR2LUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat BGR2Gray(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat BGR2Gray(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from RGB color space to YUV color space.
|
||||
|
||||
@@ -1429,7 +1429,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa YUV2RGB, RGB2Lab
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2YUV(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat RGB2YUV(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from BGR color space to I420 color space.
|
||||
|
||||
@@ -1445,7 +1445,7 @@ Height of I420 output image must be equal 3/2 from height of input image.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa I4202BGR
|
||||
*/
|
||||
GAPI_EXPORTS GMat BGR2I420(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat BGR2I420(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from RGB color space to I420 color space.
|
||||
|
||||
@@ -1461,7 +1461,7 @@ Height of I420 output image must be equal 3/2 from height of input image.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa I4202RGB
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2I420(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat RGB2I420(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from I420 color space to BGR color space.
|
||||
|
||||
@@ -1477,7 +1477,7 @@ Height of BGR output image must be equal 2/3 from height of input image.
|
||||
@param src input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@sa BGR2I420
|
||||
*/
|
||||
GAPI_EXPORTS GMat I4202BGR(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat I4202BGR(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from I420 color space to BGR color space.
|
||||
|
||||
@@ -1493,7 +1493,7 @@ Height of RGB output image must be equal 2/3 from height of input image.
|
||||
@param src input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@sa RGB2I420
|
||||
*/
|
||||
GAPI_EXPORTS GMat I4202RGB(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat I4202RGB(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from BGR color space to LUV color space.
|
||||
|
||||
@@ -1507,7 +1507,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa RGB2Lab, RGB2LUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat BGR2LUV(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat BGR2LUV(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from LUV color space to BGR color space.
|
||||
|
||||
@@ -1521,7 +1521,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa BGR2LUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat LUV2BGR(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat LUV2BGR(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from YUV color space to BGR color space.
|
||||
|
||||
@@ -1535,7 +1535,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa BGR2YUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat YUV2BGR(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat YUV2BGR(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from BGR color space to YUV color space.
|
||||
|
||||
@@ -1549,7 +1549,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@sa YUV2BGR
|
||||
*/
|
||||
GAPI_EXPORTS GMat BGR2YUV(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat BGR2YUV(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from RGB color space to Lab color space.
|
||||
|
||||
@@ -1563,7 +1563,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC1.
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC1.
|
||||
@sa RGB2YUV, RGB2LUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2Lab(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat RGB2Lab(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from YUV color space to RGB.
|
||||
The function converts an input image from YUV color space to RGB.
|
||||
@@ -1577,7 +1577,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
|
||||
@sa RGB2Lab, RGB2YUV
|
||||
*/
|
||||
GAPI_EXPORTS GMat YUV2RGB(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat YUV2RGB(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from NV12 (YUV420p) color space to RGB.
|
||||
The function converts an input image from NV12 color space to RGB.
|
||||
@@ -1592,7 +1592,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
|
||||
@sa YUV2RGB, NV12toBGR
|
||||
*/
|
||||
GAPI_EXPORTS GMat NV12toRGB(const GMat& src_y, const GMat& src_uv);
|
||||
GAPI_EXPORTS_W GMat NV12toRGB(const GMat& src_y, const GMat& src_uv);
|
||||
|
||||
/** @brief Converts an image from NV12 (YUV420p) color space to gray-scaled.
|
||||
The function converts an input image from NV12 color space to gray-scaled.
|
||||
@@ -1607,7 +1607,7 @@ Output image must be 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
|
||||
@sa YUV2RGB, NV12toBGR
|
||||
*/
|
||||
GAPI_EXPORTS GMat NV12toGray(const GMat& src_y, const GMat& src_uv);
|
||||
GAPI_EXPORTS_W GMat NV12toGray(const GMat& src_y, const GMat& src_uv);
|
||||
|
||||
/** @brief Converts an image from NV12 (YUV420p) color space to BGR.
|
||||
The function converts an input image from NV12 color space to RGB.
|
||||
@@ -1622,7 +1622,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
|
||||
@sa YUV2BGR, NV12toRGB
|
||||
*/
|
||||
GAPI_EXPORTS GMat NV12toBGR(const GMat& src_y, const GMat& src_uv);
|
||||
GAPI_EXPORTS_W GMat NV12toBGR(const GMat& src_y, const GMat& src_uv);
|
||||
|
||||
/** @brief Converts an image from BayerGR color space to RGB.
|
||||
The function converts an input image from BayerGR color space to RGB.
|
||||
@@ -1636,7 +1636,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
|
||||
@sa YUV2BGR, NV12toRGB
|
||||
*/
|
||||
GAPI_EXPORTS GMat BayerGR2RGB(const GMat& src_gr);
|
||||
GAPI_EXPORTS_W GMat BayerGR2RGB(const GMat& src_gr);
|
||||
|
||||
/** @brief Converts an image from RGB color space to HSV.
|
||||
The function converts an input image from RGB color space to HSV.
|
||||
@@ -1650,7 +1650,7 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
|
||||
@sa YUV2BGR, NV12toRGB
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2HSV(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat RGB2HSV(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from RGB color space to YUV422.
|
||||
The function converts an input image from RGB color space to YUV422.
|
||||
@@ -1664,7 +1664,7 @@ Output image must be 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
|
||||
@sa YUV2BGR, NV12toRGB
|
||||
*/
|
||||
GAPI_EXPORTS GMat RGB2YUV422(const GMat& src);
|
||||
GAPI_EXPORTS_W GMat RGB2YUV422(const GMat& src);
|
||||
|
||||
/** @brief Converts an image from NV12 (YUV420p) color space to RGB.
|
||||
The function converts an input image from NV12 color space to RGB.
|
||||
|
||||
@@ -397,7 +397,7 @@ void inline unpackBlobs(const cv::GInferInputs::Map& blobs,
|
||||
kinds.emplace_back(cv::detail::OpaqueKind::CV_UNKNOWN);
|
||||
break;
|
||||
default:
|
||||
GAPI_Assert(false);
|
||||
GAPI_Error("InternalError");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -629,7 +629,7 @@ infer2(const std::string& tag,
|
||||
kinds.emplace_back(cv::detail::OpaqueKind::CV_RECT);
|
||||
break;
|
||||
default:
|
||||
GAPI_Assert(false);
|
||||
GAPI_Error("InternalError");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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_GAPI_INFER_BINDINGS_ONNX_HPP
|
||||
#define OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
|
||||
|
||||
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
||||
#include <opencv2/gapi/infer/onnx.hpp> // Params
|
||||
#include "opencv2/gapi/own/exports.hpp" // GAPI_EXPORTS
|
||||
#include <opencv2/gapi/util/any.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
namespace onnx {
|
||||
|
||||
// NB: Used by python wrapper
|
||||
// This class can be marked as SIMPLE, because it's implemented as pimpl
|
||||
class GAPI_EXPORTS_W_SIMPLE PyParams {
|
||||
public:
|
||||
GAPI_WRAP
|
||||
PyParams() = default;
|
||||
|
||||
GAPI_WRAP
|
||||
PyParams(const std::string& tag, const std::string& model_path);
|
||||
|
||||
GBackend backend() const;
|
||||
std::string tag() const;
|
||||
cv::util::any params() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Params<cv::gapi::Generic>> m_priv;
|
||||
};
|
||||
|
||||
GAPI_EXPORTS_W PyParams params(const std::string& tag, const std::string& model_path);
|
||||
|
||||
} // namespace onnx
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_INFER_BINDINGS_ONNX_HPP
|
||||
@@ -52,6 +52,8 @@ enum class TraitAs: int
|
||||
|
||||
using IEConfig = std::map<std::string, std::string>;
|
||||
|
||||
enum InferMode {Sync, Async};
|
||||
|
||||
namespace detail {
|
||||
struct ParamDesc {
|
||||
std::string model_path;
|
||||
@@ -88,6 +90,20 @@ struct ParamDesc {
|
||||
|
||||
cv::optional<cv::gapi::wip::onevpl::Device> vpl_preproc_device;
|
||||
cv::optional<cv::gapi::wip::onevpl::Context> vpl_preproc_ctx;
|
||||
|
||||
InferMode mode;
|
||||
|
||||
using PrecisionT = int;
|
||||
using PrecisionMapT = std::unordered_map<std::string, PrecisionT>;
|
||||
// NB: This parameter can contain:
|
||||
// 1. cv::util::monostate - Don't specify precision, but use default from IR/Blob.
|
||||
// 2. PrecisionT (CV_8U, CV_32F, ...) - Specifies precision for all output layers.
|
||||
// 3. PrecisionMapT ({{"layer0", CV_32F}, {"layer1", CV_16F}} - Specifies precision for certain output layer.
|
||||
// cv::util::monostate is default value that means precision wasn't specified.
|
||||
using PrecisionVariantT = cv::util::variant<cv::util::monostate,
|
||||
PrecisionT,
|
||||
PrecisionMapT>;
|
||||
PrecisionVariantT output_precision;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -132,7 +148,9 @@ public:
|
||||
, {}
|
||||
, {}
|
||||
, {}
|
||||
, {}} {
|
||||
, {}
|
||||
, InferMode::Async
|
||||
, {} } {
|
||||
};
|
||||
|
||||
/** @overload
|
||||
@@ -156,7 +174,9 @@ public:
|
||||
, {}
|
||||
, {}
|
||||
, {}
|
||||
, {}} {
|
||||
, {}
|
||||
, InferMode::Async
|
||||
, {} } {
|
||||
};
|
||||
|
||||
/** @brief Specifies sequence of network input layers names for inference.
|
||||
@@ -351,6 +371,47 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @brief Specifies which api will be used to run inference.
|
||||
|
||||
The function is used to specify mode for OpenVINO inference.
|
||||
OpenVINO has two options to run inference:
|
||||
1. Asynchronous (using StartAsync: https://docs.openvino.ai/latest/classInferenceEngine_1_1InferRequest.html#doxid-class-inference-engine-1-1-infer-request-1a405293e8423d82a5b45f642a3bef0d24)
|
||||
2. Synchronous (using Infer: https://docs.openvino.ai/latest/classInferenceEngine_1_1InferRequest.html#doxid-class-inference-engine-1-1-infer-request-1a3391ce30894abde730523e9ca9371ce8)
|
||||
By default asynchronous mode is used.
|
||||
|
||||
@param mode Inference mode which will be used.
|
||||
@return reference to this parameter structure.
|
||||
*/
|
||||
Params<Net>& cfgInferMode(InferMode mode) {
|
||||
desc.mode = mode;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @brief Specifies the output precision for model.
|
||||
|
||||
The function is used to set an output precision for model.
|
||||
|
||||
@param precision Precision in OpenCV format (CV_8U, CV_32F, ...)
|
||||
will be applied to all output layers.
|
||||
@return reference to this parameter structure.
|
||||
*/
|
||||
Params<Net>& cfgOutputPrecision(detail::ParamDesc::PrecisionT precision) {
|
||||
desc.output_precision = precision;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload
|
||||
|
||||
@param precision_map Map of pairs: name of corresponding output layer
|
||||
and its precision in OpenCV format (CV_8U, CV_32F, ...)
|
||||
@return reference to this parameter structure.
|
||||
*/
|
||||
Params<Net>&
|
||||
cfgOutputPrecision(detail::ParamDesc::PrecisionMapT precision_map) {
|
||||
desc.output_precision = precision_map;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// BEGIN(G-API's network parametrization API)
|
||||
GBackend backend() const { return cv::gapi::ie::backend(); }
|
||||
std::string tag() const { return Net::tag(); }
|
||||
@@ -385,7 +446,7 @@ public:
|
||||
const std::string &device)
|
||||
: desc{ model, weights, device, {}, {}, {}, 0u, 0u,
|
||||
detail::ParamDesc::Kind::Load, true, {}, {}, {}, 1u,
|
||||
{}, {}, {}, {}},
|
||||
{}, {}, {}, {}, InferMode::Async, {} },
|
||||
m_tag(tag) {
|
||||
};
|
||||
|
||||
@@ -403,7 +464,7 @@ public:
|
||||
const std::string &device)
|
||||
: desc{ model, {}, device, {}, {}, {}, 0u, 0u,
|
||||
detail::ParamDesc::Kind::Import, true, {}, {}, {}, 1u,
|
||||
{}, {}, {}, {}},
|
||||
{}, {}, {}, {}, InferMode::Async, {} },
|
||||
m_tag(tag) {
|
||||
};
|
||||
|
||||
@@ -476,6 +537,25 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::cfgInferAPI */
|
||||
Params& cfgInferMode(InferMode mode) {
|
||||
desc.mode = mode;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::cfgOutputPrecision */
|
||||
Params& cfgOutputPrecision(detail::ParamDesc::PrecisionT precision) {
|
||||
desc.output_precision = precision;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params&
|
||||
cfgOutputPrecision(detail::ParamDesc::PrecisionMapT precision_map) {
|
||||
desc.output_precision = precision_map;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// BEGIN(G-API's network parametrization API)
|
||||
GBackend backend() const { return cv::gapi::ie::backend(); }
|
||||
std::string tag() const { return m_tag; }
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <opencv2/core/cvdef.h> // GAPI_EXPORTS
|
||||
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
||||
#include <opencv2/gapi/infer.hpp> // Generic
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
@@ -67,6 +68,8 @@ struct ParamDesc {
|
||||
std::vector<bool> normalize; //!< Vector of bool values that enabled or disabled normalize of input data.
|
||||
|
||||
std::vector<std::string> names_to_remap; //!< Names of output layers that will be processed in PostProc function.
|
||||
|
||||
bool is_generic;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -103,6 +106,7 @@ public:
|
||||
desc.model_path = model;
|
||||
desc.num_in = std::tuple_size<typename Net::InArgs>::value;
|
||||
desc.num_out = std::tuple_size<typename Net::OutArgs>::value;
|
||||
desc.is_generic = false;
|
||||
};
|
||||
|
||||
/** @brief Specifies sequence of network input layers names for inference.
|
||||
@@ -277,6 +281,35 @@ protected:
|
||||
detail::ParamDesc desc;
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief This structure provides functions for generic network type that
|
||||
* fill inference parameters.
|
||||
* @see struct Generic
|
||||
*/
|
||||
template<>
|
||||
class Params<cv::gapi::Generic> {
|
||||
public:
|
||||
/** @brief Class constructor.
|
||||
|
||||
Constructs Params based on input information and sets default values for other
|
||||
inference description parameters.
|
||||
|
||||
@param tag string tag of the network for which these parameters are intended.
|
||||
@param model_path path to model file (.onnx file).
|
||||
*/
|
||||
Params(const std::string& tag, const std::string& model_path)
|
||||
: desc{model_path, 0u, 0u, {}, {}, {}, {}, {}, {}, {}, {}, {}, true}, m_tag(tag) {}
|
||||
|
||||
// BEGIN(G-API's network parametrization API)
|
||||
GBackend backend() const { return cv::gapi::onnx::backend(); }
|
||||
std::string tag() const { return m_tag; }
|
||||
cv::util::any params() const { return { desc }; }
|
||||
// END(G-API's network parametrization API)
|
||||
protected:
|
||||
detail::ParamDesc desc;
|
||||
std::string m_tag;
|
||||
};
|
||||
|
||||
} // namespace onnx
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
@@ -242,11 +242,11 @@ public:
|
||||
// The default implementation does nothing
|
||||
virtual cv::util::any blobParams() const;
|
||||
virtual void serialize(cv::gapi::s11n::IOStream&) {
|
||||
GAPI_Assert(false && "Generic serialize method of MediaFrame::IAdapter does nothing by default. "
|
||||
GAPI_Error("Generic serialize method of MediaFrame::IAdapter does nothing by default. "
|
||||
"Please, implement it in derived class to properly serialize the object.");
|
||||
}
|
||||
virtual void deserialize(cv::gapi::s11n::IIStream&) {
|
||||
GAPI_Assert(false && "Generic deserialize method of MediaFrame::IAdapter does nothing by default. "
|
||||
GAPI_Error("Generic deserialize method of MediaFrame::IAdapter does nothing by default. "
|
||||
"Please, implement it in derived class to properly deserialize the object.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,6 +119,10 @@ template<typename U> struct ocl_get_in<cv::GArray<U> >
|
||||
{
|
||||
static const std::vector<U>& get(GOCLContext &ctx, int idx) { return ctx.inArg<VectorRef>(idx).rref<U>(); }
|
||||
};
|
||||
template<> struct ocl_get_in<cv::GFrame>
|
||||
{
|
||||
static cv::MediaFrame get(GOCLContext &ctx, int idx) { return ctx.inArg<cv::MediaFrame>(idx); }
|
||||
};
|
||||
template<typename U> struct ocl_get_in<cv::GOpaque<U> >
|
||||
{
|
||||
static const U& get(GOCLContext &ctx, int idx) { return ctx.inArg<OpaqueRef>(idx).rref<U>(); }
|
||||
@@ -149,6 +153,10 @@ struct tracked_cv_umat{
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4702) // unreachable code
|
||||
#endif
|
||||
template<typename... Outputs>
|
||||
void postprocess_ocl(Outputs&... outs)
|
||||
{
|
||||
@@ -162,6 +170,9 @@ void postprocess_ocl(Outputs&... outs)
|
||||
int dummy[] = { 0, (validate(&outs), 0)... };
|
||||
cv::util::suppress_unused_warning(dummy);
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<class T> struct ocl_get_out;
|
||||
template<> struct ocl_get_out<cv::GMat>
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
# define GAPI_DbgAssert(expr) GAPI_DbgAssertNoOp(expr)
|
||||
#endif
|
||||
|
||||
#define GAPI_Error(msg) CV_Error(cv::Error::StsError, msg)
|
||||
|
||||
#else
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
@@ -49,6 +51,10 @@ namespace detail
|
||||
# define GAPI_DbgAssert(expr) GAPI_Assert(expr)
|
||||
#endif
|
||||
|
||||
#define GAPI_Error(msg) { \
|
||||
::detail::assert_abort(msg, __LINE__, __FILE__, __func__); \
|
||||
}
|
||||
|
||||
#endif // GAPI_STANDALONE
|
||||
|
||||
#endif // OPENCV_GAPI_OWN_ASSERT_HPP
|
||||
|
||||
@@ -31,19 +31,22 @@ struct GPythonContext
|
||||
const cv::GArgs &ins;
|
||||
const cv::GMetaArgs &in_metas;
|
||||
const cv::GTypesInfo &out_info;
|
||||
|
||||
cv::optional<cv::GArg> m_state;
|
||||
};
|
||||
|
||||
using Impl = std::function<cv::GRunArgs(const GPythonContext&)>;
|
||||
using Setup = std::function<cv::GArg(const GMetaArgs&, const GArgs&)>;
|
||||
|
||||
class GAPI_EXPORTS GPythonKernel
|
||||
{
|
||||
public:
|
||||
GPythonKernel() = default;
|
||||
GPythonKernel(Impl run);
|
||||
GPythonKernel(Impl run, Setup setup);
|
||||
|
||||
cv::GRunArgs operator()(const GPythonContext& ctx);
|
||||
private:
|
||||
Impl m_run;
|
||||
Impl run;
|
||||
Setup setup = nullptr;
|
||||
bool is_stateful = false;
|
||||
};
|
||||
|
||||
class GAPI_EXPORTS GPythonFunctor : public cv::gapi::GFunctor
|
||||
@@ -51,7 +54,8 @@ class GAPI_EXPORTS GPythonFunctor : public cv::gapi::GFunctor
|
||||
public:
|
||||
using Meta = cv::GKernel::M;
|
||||
|
||||
GPythonFunctor(const char* id, const Meta &meta, const Impl& impl);
|
||||
GPythonFunctor(const char* id, const Meta& meta, const Impl& impl,
|
||||
const Setup& setup = nullptr);
|
||||
|
||||
GKernelImpl impl() const override;
|
||||
gapi::GBackend backend() const override;
|
||||
|
||||
@@ -112,11 +112,11 @@ public:
|
||||
// is transferred to the device when the view is destroyed
|
||||
virtual View access(Access) = 0;
|
||||
virtual void serialize(cv::gapi::s11n::IOStream&) {
|
||||
GAPI_Assert(false && "Generic serialize method of RMat::IAdapter does nothing by default. "
|
||||
GAPI_Error("Generic serialize method of RMat::IAdapter does nothing by default. "
|
||||
"Please, implement it in derived class to properly serialize the object.");
|
||||
}
|
||||
virtual void deserialize(cv::gapi::s11n::IIStream&) {
|
||||
GAPI_Assert(false && "Generic deserialize method of RMat::IAdapter does nothing by default. "
|
||||
GAPI_Error("Generic deserialize method of RMat::IAdapter does nothing by default. "
|
||||
"Please, implement it in derived class to properly deserialize the object.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#include <opencv2/gapi/util/util.hpp>
|
||||
|
||||
// FIXME: caused by deserialize_runarg
|
||||
#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
|
||||
#if defined _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4702)
|
||||
#endif
|
||||
|
||||
@@ -229,6 +230,9 @@ GAPI_EXPORTS IIStream& operator>> (IIStream& is, cv::Point &pt);
|
||||
GAPI_EXPORTS IOStream& operator<< (IOStream& os, const cv::Point2f &pt);
|
||||
GAPI_EXPORTS IIStream& operator>> (IIStream& is, cv::Point2f &pt);
|
||||
|
||||
GAPI_EXPORTS IOStream& operator<< (IOStream& os, const cv::Point3f &pt);
|
||||
GAPI_EXPORTS IIStream& operator>> (IIStream& is, cv::Point3f &pt);
|
||||
|
||||
GAPI_EXPORTS IOStream& operator<< (IOStream& os, const cv::Size &sz);
|
||||
GAPI_EXPORTS IIStream& operator>> (IIStream& is, cv::Size &sz);
|
||||
|
||||
@@ -332,7 +336,7 @@ IIStream& operator>> (IIStream& is, std::vector<T> &ts) {
|
||||
namespace detail {
|
||||
template<typename V>
|
||||
IOStream& put_v(IOStream&, const V&, std::size_t) {
|
||||
GAPI_Assert(false && "variant>>: requested index is invalid");
|
||||
GAPI_Error("variant>>: requested index is invalid");
|
||||
};
|
||||
|
||||
template<typename V, typename X, typename... Xs>
|
||||
@@ -344,7 +348,7 @@ IOStream& put_v(IOStream& os, const V& v, std::size_t x) {
|
||||
|
||||
template<typename V>
|
||||
IIStream& get_v(IIStream&, V&, std::size_t, std::size_t) {
|
||||
GAPI_Assert(false && "variant<<: requested index is invalid");
|
||||
GAPI_Error("variant<<: requested index is invalid");
|
||||
}
|
||||
|
||||
template<typename V, typename X, typename... Xs>
|
||||
@@ -420,7 +424,7 @@ static GRunArg exec(cv::gapi::s11n::IIStream& is) {
|
||||
template<typename RA>
|
||||
struct deserialize_arg_with_adapter<RA, void> {
|
||||
static GRunArg exec(cv::gapi::s11n::IIStream&) {
|
||||
GAPI_Assert(false && "No suitable adapter class found during RMat/MediaFrame deserialization. "
|
||||
GAPI_Error("No suitable adapter class found during RMat/MediaFrame deserialization. "
|
||||
"Please, make sure you've passed them in cv::gapi::deserialize() template");
|
||||
return GRunArg{};
|
||||
}
|
||||
@@ -502,4 +506,8 @@ cv::GRunArgs getRunArgsWithAdapters(const std::vector<char> &bytes) {
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
#if defined _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // OPENCV_GAPI_S11N_HPP
|
||||
|
||||
@@ -52,7 +52,7 @@ struct S11N: public NotImplemented {
|
||||
* properly overload the function to use it.
|
||||
*/
|
||||
static void serialize(IOStream &, const T &) {
|
||||
GAPI_Assert(false && "No serialization routine is provided!");
|
||||
GAPI_Error("No serialization routine is provided!");
|
||||
}
|
||||
/**
|
||||
* @brief This function allows user to deserialize their custom type.
|
||||
@@ -61,7 +61,7 @@ struct S11N: public NotImplemented {
|
||||
* properly overload the function to use it.
|
||||
*/
|
||||
static T deserialize(IIStream &) {
|
||||
GAPI_Assert(false && "No deserialization routine is provided!");
|
||||
GAPI_Error("No deserialization routine is provided!");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ G_TYPED_KERNEL(GStereo, <GMat(GMat, GMat, const StereoOutputFormat)>, "org.openc
|
||||
case StereoOutputFormat::DISPARITY_FIXED16_12_4:
|
||||
return left.withDepth(CV_16SC1);
|
||||
default:
|
||||
GAPI_Assert(false && "Unknown output format!");
|
||||
GAPI_Error("Unknown output format!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
cv::Mat tmp;
|
||||
if (!cap.read(tmp))
|
||||
{
|
||||
GAPI_Assert(false && "Couldn't grab the very first frame");
|
||||
GAPI_Error("Couldn't grab the very first frame");
|
||||
}
|
||||
// NOTE: Some decode/media VideoCapture backends continue
|
||||
// owning the video buffer under cv::Mat so in order to
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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.
|
||||
//
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
|
||||
#ifndef OPENCV_GAPI_STREAMING_ONEVPL_UTILS_HPP
|
||||
#define OPENCV_GAPI_STREAMING_ONEVPL_UTILS_HPP
|
||||
|
||||
#include <opencv2/gapi/own/exports.hpp> // GAPI_EXPORTS
|
||||
#include <opencv2/gapi/streaming/onevpl/cfg_params.hpp>
|
||||
#include <opencv2/gapi/streaming/onevpl/device_selector_interface.hpp>
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
namespace wip {
|
||||
namespace onevpl {
|
||||
|
||||
/**
|
||||
* @brief Provides default device selector based on config.
|
||||
*/
|
||||
GAPI_EXPORTS std::shared_ptr<IDeviceSelector> getDefaultDeviceSelector(const std::vector<CfgParam>& cfg_params);
|
||||
|
||||
} // namespace onevpl
|
||||
} // namespace wip
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_STREAMING_ONEVPL_UTILS_HPP
|
||||
Reference in New Issue
Block a user