1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #13721 from smirnov-alexey:gapi_add_normalize

GAPI: Add normalize kernel in G-API (#13721)

* Add normalize kernel in G-API

In addition add several tests on new kernel

* Fix indentations and normalize test structure

* Move normalize kernel from imgproc to core

Set default parameter ddepth to -1

* Fix alignment
This commit is contained in:
Alexey Smirnov
2019-02-07 16:05:39 +03:00
committed by Alexander Alekhin
parent fcec053d59
commit 315e7fbbee
8 changed files with 94 additions and 1 deletions
@@ -459,6 +459,13 @@ namespace core {
return in;
}
};
G_TYPED_KERNEL(GNormalize, <GMat(GMat, double, double, int, int)>, "org.opencv.core.normalize") {
static GMatDesc outMeta(GMatDesc in, double, double, int, int ddepth) {
// unlike opencv doesn't have a mask as a parameter
return (ddepth < 0 ? in : in.withDepth(ddepth));
}
};
}
//! @addtogroup gapi_math
@@ -1592,6 +1599,29 @@ same as the input has; if rdepth is negative, the output matrix will have the sa
@param beta optional delta added to the scaled values.
*/
GAPI_EXPORTS GMat convertTo(const GMat& src, int rdepth, double alpha=1, double beta=0);
/** @brief Normalizes the norm or value range of an array.
The function normalizes scale and shift the input array elements so that
\f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f]
(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
\f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f]
when normType=NORM_MINMAX (for dense arrays only).
@note Function textual ID is "org.opencv.core.normalize"
@param src input array.
@param alpha norm value to normalize to or the lower range boundary in case of the range
normalization.
@param beta upper range boundary in case of the range normalization; it is not used for the norm
normalization.
@param norm_type normalization type (see cv::NormTypes).
@param ddepth when negative, the output array has the same type as src; otherwise, it has the same
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_transform
} //namespace gapi
@@ -669,7 +669,6 @@ Output image must be 8-bit unsigned 3-channel image @ref CV_8UC3.
@sa RGB2Lab, RGB2YUV
*/
GAPI_EXPORTS GMat YUV2RGB(const GMat& src);
//! @} gapi_colorconvert
} //namespace gapi
} //namespace cv