1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge pull request #19112 from rgarnov:rg/generic_copy_kernel

Generic copy kernel

* Moved RMat wrapping of cv::Mats to StreamingInput

* Generalized GCopy kernel

* Generic GCopy kernel: applied review comments
This commit is contained in:
Ruslan Garnov
2020-12-16 14:18:08 +03:00
committed by GitHub
parent 50baf76cc2
commit f7cab121fe
19 changed files with 161 additions and 180 deletions
@@ -451,12 +451,6 @@ namespace core {
}
};
G_TYPED_KERNEL(GCopy, <GMat(GMat)>, "org.opencv.core.transform.copy") {
static GMatDesc outMeta(GMatDesc in) {
return in;
}
};
G_TYPED_KERNEL(GConcatHor, <GMat(GMat, GMat)>, "org.opencv.imgproc.transform.concatHor") {
static GMatDesc outMeta(GMatDesc l, GMatDesc r) {
return l.withSizeDelta(+r.size.width, 0);
@@ -1667,19 +1661,6 @@ Output matrix must be of the same depth as input one, size is specified by given
*/
GAPI_EXPORTS GMat crop(const GMat& src, const Rect& rect);
/** @brief Copies a matrix.
Copies an input array. Works as a regular Mat::clone but happens in-graph.
Mainly is used to workaround some existing limitations (e.g. to forward an input frame to outputs
in the streaming mode). Will be deprecated and removed in the future.
@note Function textual ID is "org.opencv.core.transform.copy"
@param src input matrix.
@sa crop
*/
GAPI_EXPORTS GMat copy(const GMat& src);
/** @brief Applies horizontal concatenation to given matrices.
The function horizontally concatenates two GMat matrices (with the same number of rows).
@@ -15,26 +15,11 @@ namespace streaming {
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
// FIXME: Make a generic kernel
G_API_OP(GCopy, <GFrame(GFrame)>, "org.opencv.streaming.copy")
{
static GFrameDesc outMeta(const GFrameDesc& in) { return in; }
};
G_API_OP(GBGR, <GMat(GFrame)>, "org.opencv.streaming.BGR")
{
static GMatDesc outMeta(const GFrameDesc& in) { return GMatDesc{CV_8U, 3, in.size}; }
};
/** @brief Gets copy from the input frame
@note Function textual ID is "org.opencv.streaming.copy"
@param in Input frame
@return Copy of the input frame
*/
GAPI_EXPORTS cv::GFrame copy(const cv::GFrame& in);
/** @brief Gets bgr plane from input frame
@note Function textual ID is "org.opencv.streaming.BGR"
@@ -42,9 +27,32 @@ GAPI_EXPORTS cv::GFrame copy(const cv::GFrame& in);
@param in Input frame
@return Image in BGR format
*/
GAPI_EXPORTS cv::GMat BGR (const cv::GFrame& in);
GAPI_EXPORTS cv::GMat BGR(const cv::GFrame& in);
} // namespace streaming
/** @brief Makes a copy of the input image. Note that this copy may be not real
(no actual data copied). Use this function to maintain graph contracts,
e.g when graph's input needs to be passed directly to output, like in Streaming mode.
@note Function textual ID is "org.opencv.streaming.copy"
@param in Input image
@return Copy of the input
*/
GAPI_EXPORTS cv::GMat copy(const cv::GMat& in);
/** @brief Makes a copy of the input frame. Note that this copy may be not real
(no actual data copied). Use this function to maintain graph contracts,
e.g when graph's input needs to be passed directly to output, like in Streaming mode.
@note Function textual ID is "org.opencv.streaming.copy"
@param in Input frame
@return Copy of the input
*/
GAPI_EXPORTS cv::GFrame copy(const cv::GFrame& in);
} // namespace gapi
} // namespace cv