From 4dffcbd9f0f680d248450372acf34db7f0e99b39 Mon Sep 17 00:00:00 2001 From: "Talamanov, Anatoliy" Date: Thu, 6 Feb 2020 15:12:38 +0300 Subject: [PATCH] Fix render opencv backend text slowdown --- modules/gapi/src/api/render_ocv.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/modules/gapi/src/api/render_ocv.cpp b/modules/gapi/src/api/render_ocv.cpp index 74a0b07a8a..a298a958bd 100644 --- a/modules/gapi/src/api/render_ocv.cpp +++ b/modules/gapi/src/api/render_ocv.cpp @@ -167,27 +167,11 @@ void drawPrimitivesOCV(cv::Mat& in, break; } - // FIXME avoid code duplicate for Text and FText case Prim::index_of(): { auto tp = cv::util::get(p); tp.color = converter.cvtColor(tp.color); - - int baseline = 0; - auto size = cv::getTextSize(tp.text, tp.ff, tp.fs, tp.thick, &baseline); - baseline += tp.thick; - size.height += baseline; - - // Allocate mask outside - cv::Mat mask(size, CV_8UC1, cv::Scalar::all(0)); - // Org it's bottom left position for baseline - cv::Point org(0, mask.rows - baseline); - cv::putText(mask, tp.text, org, tp.ff, tp.fs, 255, tp.thick); - - // Org is bottom left point, transform it to top left point for blendImage - cv::Point tl(tp.org.x, tp.org.y - mask.size().height + baseline); - - blendTextMask(in, mask, tl, tp.color); + cv::putText(in, tp.text, tp.org, tp.ff, tp.fs, tp.color, tp.thick, tp.lt, tp.bottom_left_origin); break; }