Merge pull request #15699 from TolyaTalamanov:at/graph-ocv-render-backend-skeleton
G-API: Implement OpenCV render backend * Implement render opencv backend * Fix comment to review * Add comment * Add wrappers for kernels * Fix comments to review * Fix comment to review
This commit is contained in:
committed by
Alexander Alekhin
parent
cc9b199ecb
commit
2ff12c4981
@@ -28,6 +28,14 @@ namespace gimpl
|
||||
{
|
||||
// Forward-declare an internal class
|
||||
class GCPUExecutable;
|
||||
|
||||
namespace render
|
||||
{
|
||||
namespace ocv
|
||||
{
|
||||
class GRenderExecutable;
|
||||
}
|
||||
}
|
||||
} // namespace gimpl
|
||||
|
||||
namespace gapi
|
||||
@@ -98,6 +106,7 @@ protected:
|
||||
std::unordered_map<std::size_t, GRunArgP> m_results;
|
||||
|
||||
friend class gimpl::GCPUExecutable;
|
||||
friend class gimpl::render::ocv::GRenderExecutable;
|
||||
};
|
||||
|
||||
class GAPI_EXPORTS GCPUKernel
|
||||
|
||||
+56
-18
@@ -23,13 +23,21 @@ namespace cv
|
||||
namespace gapi
|
||||
{
|
||||
|
||||
namespace ocv { GAPI_EXPORTS cv::gapi::GKernelPackage kernels(); }
|
||||
|
||||
namespace wip
|
||||
{
|
||||
namespace draw
|
||||
{
|
||||
|
||||
/**
|
||||
* A structure allows using freetype library for text rendering
|
||||
*/
|
||||
struct use_freetype
|
||||
{
|
||||
/*@{*/
|
||||
std::string path; //!< The path to font file (.ttf)
|
||||
/*@{*/
|
||||
};
|
||||
|
||||
/**
|
||||
* A structure to represent parameters for drawing a text string.
|
||||
*/
|
||||
@@ -131,6 +139,28 @@ using Prims = std::vector<Prim>;
|
||||
using GMat2 = std::tuple<cv::GMat,cv::GMat>;
|
||||
using GMatDesc2 = std::tuple<cv::GMatDesc,cv::GMatDesc>;
|
||||
|
||||
/** @brief The function renders on the input image passed drawing primitivies
|
||||
|
||||
@param bgr input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param prims vector of drawing primitivies
|
||||
@param args graph compile time parameters
|
||||
*/
|
||||
void GAPI_EXPORTS render(cv::Mat& bgr,
|
||||
const Prims& prims,
|
||||
cv::GCompileArgs&& args = {});
|
||||
|
||||
/** @brief The function renders on two NV12 planes passed drawing primitivies
|
||||
|
||||
@param y_plane input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@param uv_plane input image: 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
@param prims vector of drawing primitivies
|
||||
@param args graph compile time parameters
|
||||
*/
|
||||
void GAPI_EXPORTS render(cv::Mat& y_plane,
|
||||
cv::Mat& uv_plane,
|
||||
const Prims& prims,
|
||||
cv::GCompileArgs&& args = {});
|
||||
|
||||
G_TYPED_KERNEL_M(GRenderNV12, <GMat2(cv::GMat,cv::GMat,cv::GArray<wip::draw::Prim>)>, "org.opencv.render.nv12")
|
||||
{
|
||||
static GMatDesc2 outMeta(GMatDesc y_plane, GMatDesc uv_plane, GArrayDesc)
|
||||
@@ -147,31 +177,39 @@ G_TYPED_KERNEL(GRenderBGR, <cv::GMat(cv::GMat,cv::GArray<wip::draw::Prim>)>, "or
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief The function renders on the input image passed drawing primitivies
|
||||
/** @brief Renders on 3 channels input
|
||||
|
||||
@param bgr input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
|
||||
@param prims vector of drawing primitivies
|
||||
@param pkg contains render kernel implementation
|
||||
Output image must be 8-bit unsigned planar 3-channel image
|
||||
|
||||
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3
|
||||
@param prims draw primitives
|
||||
*/
|
||||
GAPI_EXPORTS void render(cv::Mat& bgr,
|
||||
const Prims& prims,
|
||||
const cv::gapi::GKernelPackage& pkg = ocv::kernels());
|
||||
GAPI_EXPORTS GMat render3ch(const GMat& src, const GArray<Prim>& prims);
|
||||
|
||||
/** @brief The function renders on two NV12 planes passed drawing primitivies
|
||||
/** @brief Renders on two planes
|
||||
|
||||
@param y_plane input image: 8-bit unsigned 1-channel image @ref CV_8UC1.
|
||||
@param uv_plane input image: 8-bit unsigned 2-channel image @ref CV_8UC2.
|
||||
@param prims vector of drawing primitivies
|
||||
@param pkg contains render kernel implementation
|
||||
Output y image must be 8-bit unsigned planar 1-channel image @ref CV_8UC1
|
||||
uv image must be 8-bit unsigned planar 2-channel image @ref CV_8UC2
|
||||
|
||||
@param y input image: 8-bit unsigned 1-channel image @ref CV_8UC1
|
||||
@param uv input image: 8-bit unsigned 2-channel image @ref CV_8UC2
|
||||
@param prims draw primitives
|
||||
*/
|
||||
GAPI_EXPORTS void render(cv::Mat& y_plane,
|
||||
cv::Mat& uv_plane,
|
||||
const Prims& prims,
|
||||
const cv::gapi::GKernelPackage& pkg = ocv::kernels());
|
||||
GAPI_EXPORTS GMat2 renderNV12(const GMat& y,
|
||||
const GMat& uv,
|
||||
const GArray<Prim>& prims);
|
||||
|
||||
} // namespace draw
|
||||
} // namespace wip
|
||||
|
||||
namespace render
|
||||
{
|
||||
namespace ocv
|
||||
{
|
||||
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
|
||||
|
||||
} // namespace ocv
|
||||
} // namespace render
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
Reference in New Issue
Block a user