Merge pull request #14917 from rgarnov:gapi_planar_kernels
G-API planar kernels (#14917) * Added resizeP with tests * NV12 planar filters * fix warnings in ResizeP test * fix out mat ocv warning * sz_on - > sz rename * cpu tests new signature * try to fix resizeP test * trailing spaces remove * doxygen doc fixed * doxygen minor fix * more doxygen fixes * Doxygen corrected and extended after review.
This commit is contained in:
committed by
Alexander Alekhin
parent
097d81363b
commit
ad49138fae
@@ -398,6 +398,16 @@ namespace core {
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GResizeP, <GMatP(GMatP,Size,int)>, "org.opencv.core.transform.resizeP") {
|
||||
static GMatDesc outMeta(GMatDesc in, Size sz, int interp) {
|
||||
GAPI_Assert(in.depth == CV_8U);
|
||||
GAPI_Assert(in.chan == 3);
|
||||
GAPI_Assert(in.planar);
|
||||
GAPI_Assert(interp == cv::INTER_LINEAR);
|
||||
return in.withSize(sz);
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GMerge3, <GMat(GMat,GMat,GMat)>, "org.opencv.core.transform.merge3") {
|
||||
static GMatDesc outMeta(GMatDesc in, GMatDesc, GMatDesc) {
|
||||
// Preserve depth and add channel component
|
||||
@@ -1342,10 +1352,28 @@ enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv:
|
||||
\f[\texttt{(double)dsize.height/src.rows}\f]
|
||||
@param interpolation interpolation method, see cv::InterpolationFlags
|
||||
|
||||
@sa warpAffine, warpPerspective, remap
|
||||
@sa warpAffine, warpPerspective, remap, resizeP
|
||||
*/
|
||||
GAPI_EXPORTS GMat resize(const GMat& src, const Size& dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR);
|
||||
|
||||
/** @brief Resizes a planar image.
|
||||
|
||||
The function resizes the image src down to or up to the specified size.
|
||||
Planar image memory layout is three planes laying in the memory contiguously,
|
||||
so the image height should be plane_height*plane_number, image type is @ref CV_8UC1.
|
||||
|
||||
Output image size will have the size dsize, the depth of output is the same as of src.
|
||||
|
||||
@note Function textual ID is "org.opencv.core.transform.resizeP"
|
||||
|
||||
@param src input image, must be of @ref CV_8UC1 type;
|
||||
@param dsize output image size;
|
||||
@param interpolation interpolation method, only cv::INTER_LINEAR is supported at the moment
|
||||
|
||||
@sa warpAffine, warpPerspective, remap, resize
|
||||
*/
|
||||
GAPI_EXPORTS GMatP resizeP(const GMatP& src, const Size& dsize, int interpolation = cv::INTER_LINEAR);
|
||||
|
||||
/** @brief Creates one 3-channel (4-channel) matrix out of 3(4) single-channel ones.
|
||||
|
||||
The function merges several matrices to make a single multi-channel matrix. That is, each
|
||||
|
||||
@@ -207,6 +207,35 @@ namespace imgproc {
|
||||
return in.withType(in.depth, 2);
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GNV12toRGBp, <GMatP(GMat,GMat)>, "org.opencv.colorconvert.imgproc.nv12torgbp") {
|
||||
static GMatDesc outMeta(GMatDesc inY, GMatDesc inUV) {
|
||||
GAPI_Assert(inY.depth == CV_8U);
|
||||
GAPI_Assert(inUV.depth == CV_8U);
|
||||
GAPI_Assert(inY.chan == 1);
|
||||
GAPI_Assert(inY.planar == false);
|
||||
GAPI_Assert(inUV.chan == 2);
|
||||
GAPI_Assert(inUV.planar == false);
|
||||
GAPI_Assert(inY.size.width == 2 * inUV.size.width);
|
||||
GAPI_Assert(inY.size.height == 2 * inUV.size.height);
|
||||
return inY.withType(CV_8U, 3).asPlanar();
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GNV12toBGRp, <GMatP(GMat,GMat)>, "org.opencv.colorconvert.imgproc.nv12tobgrp") {
|
||||
static GMatDesc outMeta(GMatDesc inY, GMatDesc inUV) {
|
||||
GAPI_Assert(inY.depth == CV_8U);
|
||||
GAPI_Assert(inUV.depth == CV_8U);
|
||||
GAPI_Assert(inY.chan == 1);
|
||||
GAPI_Assert(inY.planar == false);
|
||||
GAPI_Assert(inUV.chan == 2);
|
||||
GAPI_Assert(inUV.planar == false);
|
||||
GAPI_Assert(inY.size.width == 2 * inUV.size.width);
|
||||
GAPI_Assert(inY.size.height == 2 * inUV.size.height);
|
||||
return inY.withType(CV_8U, 3).asPlanar();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -847,6 +876,42 @@ Output image must be 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
*/
|
||||
GAPI_EXPORTS 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.
|
||||
The conventional ranges for Y, U, and V channel values are 0 to 255.
|
||||
|
||||
Output image must be 8-bit unsigned planar 3-channel image @ref CV_8UC1.
|
||||
Planar image memory layout is three planes laying in the memory contiguously,
|
||||
so the image height should be plane_height*plane_number,
|
||||
image type is @ref CV_8UC1.
|
||||
|
||||
@note Function textual ID is "org.opencv.imgproc.colorconvert.nv12torgbp"
|
||||
|
||||
@param src_y input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@param src_uv input image: 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
|
||||
@sa YUV2RGB, NV12toBGRp, NV12toRGB
|
||||
*/
|
||||
GAPI_EXPORTS GMatP NV12toRGBp(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 BGR.
|
||||
The conventional ranges for Y, U, and V channel values are 0 to 255.
|
||||
|
||||
Output image must be 8-bit unsigned planar 3-channel image @ref CV_8UC1.
|
||||
Planar image memory layout is three planes laying in the memory contiguously,
|
||||
so the image height should be plane_height*plane_number,
|
||||
image type is @ref CV_8UC1.
|
||||
|
||||
@note Function textual ID is "org.opencv.imgproc.colorconvert.nv12torgbp"
|
||||
|
||||
@param src_y input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@param src_uv input image: 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
|
||||
@sa YUV2RGB, NV12toRGBp, NV12toBGR
|
||||
*/
|
||||
GAPI_EXPORTS GMatP NV12toBGRp(const GMat &src_y, const GMat &src_uv);
|
||||
|
||||
//! @} gapi_colorconvert
|
||||
} //namespace gapi
|
||||
} //namespace cv
|
||||
|
||||
Reference in New Issue
Block a user