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

Implement cv::gapi::wip::draw::FText

This commit is contained in:
Talamanov, Anatoliy
2019-12-03 13:13:06 +03:00
parent 4b0132ed7a
commit 63b154396a
18 changed files with 648 additions and 39 deletions
+10 -6
View File
@@ -1,3 +1,7 @@
#include "precomp.hpp"
#include <stdexcept>
#include <opencv2/imgproc.hpp>
#include <opencv2/gapi/render/render.hpp>
#include <opencv2/gapi/own/assert.hpp>
@@ -9,7 +13,7 @@ void cv::gapi::wip::draw::render(cv::Mat& bgr,
cv::GCompileArgs&& args)
{
cv::GMat in;
cv::GArray<Prim> arr;
cv::GArray<cv::gapi::wip::draw::Prim> arr;
cv::GComputation comp(cv::GIn(in, arr),
cv::GOut(cv::gapi::wip::draw::render3ch(in, arr)));
@@ -22,7 +26,7 @@ void cv::gapi::wip::draw::render(cv::Mat& y_plane,
cv::GCompileArgs&& args)
{
cv::GMat y_in, uv_in, y_out, uv_out;
cv::GArray<Prim> arr;
cv::GArray<cv::gapi::wip::draw::Prim> arr;
std::tie(y_out, uv_out) = cv::gapi::wip::draw::renderNV12(y_in, uv_in, arr);
cv::GComputation comp(cv::GIn(y_in, uv_in, arr), cv::GOut(y_out, uv_out));
@@ -40,7 +44,6 @@ void cv::gapi::wip::draw::cvtYUVToNV12(const cv::Mat& yuv,
std::vector<cv::Mat> chs(3);
cv::split(yuv, chs);
y = chs[0];
cv::merge(std::vector<cv::Mat>{chs[1], chs[2]}, uv);
cv::resize(uv, uv, uv.size() / 2, cv::INTER_LINEAR);
}
@@ -58,14 +61,15 @@ namespace cv
{
namespace detail
{
template<> struct CompileArgTag<cv::gapi::wip::draw::use_freetype>
template<> struct CompileArgTag<cv::gapi::wip::draw::freetype_font>
{
static const char* tag() { return "gapi.use_freetype"; }
static const char* tag() { return "gapi.freetype_font"; }
};
} // namespace detail
GMat cv::gapi::wip::draw::render3ch(const GMat& src, const GArray<Prim>& prims)
GMat cv::gapi::wip::draw::render3ch(const GMat& src,
const GArray<cv::gapi::wip::draw::Prim>& prims)
{
return cv::gapi::wip::draw::GRenderBGR::on(src, prims);
}