|
2 | 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory
|
3 | 3 | // of this distribution and at http://opencv.org/license.html.
|
4 | 4 | //
|
5 |
| -// Copyright (C) 2018-2019 Intel Corporation |
| 5 | +// Copyright (C) 2018-2020 Intel Corporation |
6 | 6 |
|
7 | 7 |
|
8 | 8 | #ifndef OPENCV_GAPI_RENDER_HPP
|
9 | 9 | #define OPENCV_GAPI_RENDER_HPP
|
10 | 10 |
|
11 |
| -#include <string> |
12 |
| -#include <vector> |
| 11 | +#include <opencv2/gapi/render/render_types.hpp> |
13 | 12 |
|
14 |
| -#include <opencv2/imgproc.hpp> |
15 | 13 | #include <opencv2/gapi.hpp>
|
16 | 14 |
|
17 |
| -#include <opencv2/gapi/opencv_includes.hpp> |
18 |
| -#include <opencv2/gapi/util/variant.hpp> |
19 |
| -#include <opencv2/gapi/own/exports.hpp> |
20 |
| - |
21 |
| - |
22 | 15 | /** \defgroup gapi_draw G-API Drawing and composition functionality
|
23 | 16 | * @{
|
24 | 17 | *
|
@@ -77,309 +70,9 @@ namespace wip
|
77 | 70 | namespace draw
|
78 | 71 | {
|
79 | 72 |
|
80 |
| -/** |
81 |
| - * @brief This structure specifies which FreeType font to use by FText primitives. |
82 |
| - */ |
83 |
| -struct freetype_font |
84 |
| -{ |
85 |
| - /*@{*/ |
86 |
| - std::string path; //!< The path to the font file (.ttf) |
87 |
| - /*@{*/ |
88 |
| -}; |
89 |
| - |
90 |
| -//! @addtogroup gapi_draw_prims |
91 |
| -//! @{ |
92 |
| -/** |
93 |
| - * @brief This structure represents a text string to draw. |
94 |
| - * |
95 |
| - * Parameters match cv::putText(). |
96 |
| - */ |
97 |
| -struct Text |
98 |
| -{ |
99 |
| - /** |
100 |
| - * @brief Text constructor |
101 |
| - * |
102 |
| - * @param text_ The text string to be drawn |
103 |
| - * @param org_ The bottom-left corner of the text string in the image |
104 |
| - * @param ff_ The font type, see #HersheyFonts |
105 |
| - * @param fs_ The font scale factor that is multiplied by the font-specific base size |
106 |
| - * @param color_ The text color |
107 |
| - * @param thick_ The thickness of the lines used to draw a text |
108 |
| - * @param lt_ The line type. See #LineTypes |
109 |
| - * @param bottom_left_origin_ When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner |
110 |
| - */ |
111 |
| - Text(const std::string& text_, |
112 |
| - const cv::Point& org_, |
113 |
| - int ff_, |
114 |
| - double fs_, |
115 |
| - const cv::Scalar& color_, |
116 |
| - int thick_ = 1, |
117 |
| - int lt_ = cv::LINE_8, |
118 |
| - bool bottom_left_origin_ = false) : |
119 |
| - text(text_), org(org_), ff(ff_), fs(fs_), |
120 |
| - color(color_), thick(thick_), lt(lt_), bottom_left_origin(bottom_left_origin_) |
121 |
| - { |
122 |
| - } |
123 |
| - |
124 |
| - /*@{*/ |
125 |
| - std::string text; //!< The text string to be drawn |
126 |
| - cv::Point org; //!< The bottom-left corner of the text string in the image |
127 |
| - int ff; //!< The font type, see #HersheyFonts |
128 |
| - double fs; //!< The font scale factor that is multiplied by the font-specific base size |
129 |
| - cv::Scalar color; //!< The text color |
130 |
| - int thick; //!< The thickness of the lines used to draw a text |
131 |
| - int lt; //!< The line type. See #LineTypes |
132 |
| - bool bottom_left_origin; //!< When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner |
133 |
| - /*@{*/ |
134 |
| -}; |
135 |
| - |
136 |
| -/** |
137 |
| - * @brief This structure represents a text string to draw using |
138 |
| - * FreeType renderer. |
139 |
| - * |
140 |
| - * If OpenCV is built without FreeType support, this primitive will |
141 |
| - * fail at the execution stage. |
142 |
| - */ |
143 |
| -struct FText |
144 |
| -{ |
145 |
| - /** |
146 |
| - * @brief FText constructor |
147 |
| - * |
148 |
| - * @param text_ The text string to be drawn |
149 |
| - * @param org_ The bottom-left corner of the text string in the image |
150 |
| - * @param fh_ The height of text |
151 |
| - * @param color_ The text color |
152 |
| - */ |
153 |
| - FText(const std::wstring& text_, |
154 |
| - const cv::Point& org_, |
155 |
| - int fh_, |
156 |
| - const cv::Scalar& color_) : |
157 |
| - text(text_), org(org_), fh(fh_), color(color_) |
158 |
| - { |
159 |
| - } |
160 |
| - |
161 |
| - /*@{*/ |
162 |
| - std::wstring text; //!< The text string to be drawn |
163 |
| - cv::Point org; //!< The bottom-left corner of the text string in the image |
164 |
| - int fh; //!< The height of text |
165 |
| - cv::Scalar color; //!< The text color |
166 |
| - /*@{*/ |
167 |
| -}; |
168 |
| - |
169 |
| -/** |
170 |
| - * @brief This structure represents a rectangle to draw. |
171 |
| - * |
172 |
| - * Parameters match cv::rectangle(). |
173 |
| - */ |
174 |
| -struct Rect |
175 |
| -{ |
176 |
| - /** |
177 |
| - * @brief Rect constructor |
178 |
| - * |
179 |
| - * @param rect_ Coordinates of the rectangle |
180 |
| - * @param color_ The bottom-left corner of the text string in the image |
181 |
| - * @param thick_ The thickness of lines that make up the rectangle. Negative values, like #FILLED, mean that the function has to draw a filled rectangle |
182 |
| - * @param lt_ The type of the line. See #LineTypes |
183 |
| - * @param shift_ The number of fractional bits in the point coordinates |
184 |
| - */ |
185 |
| - Rect(const cv::Rect& rect_, |
186 |
| - const cv::Scalar& color_, |
187 |
| - int thick_ = 1, |
188 |
| - int lt_ = cv::LINE_8, |
189 |
| - int shift_ = 0) : |
190 |
| - rect(rect_), color(color_), thick(thick_), lt(lt_), shift(shift_) |
191 |
| - { |
192 |
| - } |
193 |
| - |
194 |
| - /*@{*/ |
195 |
| - cv::Rect rect; //!< Coordinates of the rectangle |
196 |
| - cv::Scalar color; //!< The rectangle color or brightness (grayscale image) |
197 |
| - int thick; //!< The thickness of lines that make up the rectangle. Negative values, like #FILLED, mean that the function has to draw a filled rectangle |
198 |
| - int lt; //!< The type of the line. See #LineTypes |
199 |
| - int shift; //!< The number of fractional bits in the point coordinates |
200 |
| - /*@{*/ |
201 |
| -}; |
202 |
| - |
203 |
| -/** |
204 |
| - * @brief This structure represents a circle to draw. |
205 |
| - * |
206 |
| - * Parameters match cv::circle(). |
207 |
| - */ |
208 |
| -struct Circle |
209 |
| -{ |
210 |
| - /** |
211 |
| - * @brief Circle constructor |
212 |
| - * |
213 |
| - * @param center_ The center of the circle |
214 |
| - * @param radius_ The radius of the circle |
215 |
| - * @param color_ The color of the circle |
216 |
| - * @param thick_ The thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn |
217 |
| - * @param lt_ The Type of the circle boundary. See #LineTypes |
218 |
| - * @param shift_ The Number of fractional bits in the coordinates of the center and in the radius value |
219 |
| - */ |
220 |
| - Circle(const cv::Point& center_, |
221 |
| - int radius_, |
222 |
| - const cv::Scalar& color_, |
223 |
| - int thick_ = 1, |
224 |
| - int lt_ = cv::LINE_8, |
225 |
| - int shift_ = 0) : |
226 |
| - center(center_), radius(radius_), color(color_), thick(thick_), lt(lt_), shift(shift_) |
227 |
| - { |
228 |
| - } |
229 |
| - |
230 |
| - /*@{*/ |
231 |
| - cv::Point center; //!< The center of the circle |
232 |
| - int radius; //!< The radius of the circle |
233 |
| - cv::Scalar color; //!< The color of the circle |
234 |
| - int thick; //!< The thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn |
235 |
| - int lt; //!< The Type of the circle boundary. See #LineTypes |
236 |
| - int shift; //!< The Number of fractional bits in the coordinates of the center and in the radius value |
237 |
| - /*@{*/ |
238 |
| -}; |
239 |
| - |
240 |
| -/** |
241 |
| - * @brief This structure represents a line to draw. |
242 |
| - * |
243 |
| - * Parameters match cv::line(). |
244 |
| - */ |
245 |
| -struct Line |
246 |
| -{ |
247 |
| - /** |
248 |
| - * @brief Line constructor |
249 |
| - * |
250 |
| - * @param pt1_ The first point of the line segment |
251 |
| - * @param pt2_ The second point of the line segment |
252 |
| - * @param color_ The line color |
253 |
| - * @param thick_ The thickness of line |
254 |
| - * @param lt_ The Type of the line. See #LineTypes |
255 |
| - * @param shift_ The number of fractional bits in the point coordinates |
256 |
| - */ |
257 |
| - Line(const cv::Point& pt1_, |
258 |
| - const cv::Point& pt2_, |
259 |
| - const cv::Scalar& color_, |
260 |
| - int thick_ = 1, |
261 |
| - int lt_ = cv::LINE_8, |
262 |
| - int shift_ = 0) : |
263 |
| - pt1(pt1_), pt2(pt2_), color(color_), thick(thick_), lt(lt_), shift(shift_) |
264 |
| - { |
265 |
| - } |
266 |
| - |
267 |
| - /*@{*/ |
268 |
| - cv::Point pt1; //!< The first point of the line segment |
269 |
| - cv::Point pt2; //!< The second point of the line segment |
270 |
| - cv::Scalar color; //!< The line color |
271 |
| - int thick; //!< The thickness of line |
272 |
| - int lt; //!< The Type of the line. See #LineTypes |
273 |
| - int shift; //!< The number of fractional bits in the point coordinates |
274 |
| - /*@{*/ |
275 |
| -}; |
276 |
| - |
277 |
| -/** |
278 |
| - * @brief This structure represents a mosaicing operation. |
279 |
| - * |
280 |
| - * Mosaicing is a very basic method to obfuscate regions in the image. |
281 |
| - */ |
282 |
| -struct Mosaic |
283 |
| -{ |
284 |
| - /** |
285 |
| - * @brief Mosaic constructor |
286 |
| - * |
287 |
| - * @param mos_ Coordinates of the mosaic |
288 |
| - * @param cellSz_ Cell size (same for X, Y) |
289 |
| - * @param decim_ Decimation (0 stands for no decimation) |
290 |
| - */ |
291 |
| - Mosaic(const cv::Rect& mos_, |
292 |
| - int cellSz_, |
293 |
| - int decim_) : |
294 |
| - mos(mos_), cellSz(cellSz_), decim(decim_) |
295 |
| - { |
296 |
| - } |
297 |
| - |
298 |
| - /*@{*/ |
299 |
| - cv::Rect mos; //!< Coordinates of the mosaic |
300 |
| - int cellSz; //!< Cell size (same for X, Y) |
301 |
| - int decim; //!< Decimation (0 stands for no decimation) |
302 |
| - /*@{*/ |
303 |
| -}; |
304 |
| - |
305 |
| -/** |
306 |
| - * @brief This structure represents an image to draw. |
307 |
| - * |
308 |
| - * Image is blended on a frame using the specified mask. |
309 |
| - */ |
310 |
| -struct Image |
311 |
| -{ |
312 |
| - /** |
313 |
| - * @brief Mosaic constructor |
314 |
| - * |
315 |
| - * @param org_ The bottom-left corner of the image |
316 |
| - * @param img_ Image to draw |
317 |
| - * @param alpha_ Alpha channel for image to draw (same size and number of channels) |
318 |
| - */ |
319 |
| - Image(const cv::Point& org_, |
320 |
| - const cv::Mat& img_, |
321 |
| - const cv::Mat& alpha_) : |
322 |
| - org(org_), img(img_), alpha(alpha_) |
323 |
| - { |
324 |
| - } |
325 |
| - |
326 |
| - /*@{*/ |
327 |
| - cv::Point org; //!< The bottom-left corner of the image |
328 |
| - cv::Mat img; //!< Image to draw |
329 |
| - cv::Mat alpha; //!< Alpha channel for image to draw (same size and number of channels) |
330 |
| - /*@{*/ |
331 |
| -}; |
332 |
| - |
333 |
| -/** |
334 |
| - * @brief This structure represents a polygon to draw. |
335 |
| - */ |
336 |
| -struct Poly |
337 |
| -{ |
338 |
| - /** |
339 |
| - * @brief Mosaic constructor |
340 |
| - * |
341 |
| - * @param points_ Points to connect |
342 |
| - * @param color_ The line color |
343 |
| - * @param thick_ The thickness of line |
344 |
| - * @param lt_ The Type of the line. See #LineTypes |
345 |
| - * @param shift_ The number of fractional bits in the point coordinate |
346 |
| - */ |
347 |
| - Poly(const std::vector<cv::Point>& points_, |
348 |
| - const cv::Scalar& color_, |
349 |
| - int thick_ = 1, |
350 |
| - int lt_ = cv::LINE_8, |
351 |
| - int shift_ = 0) : |
352 |
| - points(points_), color(color_), thick(thick_), lt(lt_), shift(shift_) |
353 |
| - { |
354 |
| - } |
355 |
| - |
356 |
| - /*@{*/ |
357 |
| - std::vector<cv::Point> points; //!< Points to connect |
358 |
| - cv::Scalar color; //!< The line color |
359 |
| - int thick; //!< The thickness of line |
360 |
| - int lt; //!< The Type of the line. See #LineTypes |
361 |
| - int shift; //!< The number of fractional bits in the point coordinate |
362 |
| - /*@{*/ |
363 |
| -}; |
364 |
| - |
365 |
| -using Prim = util::variant |
366 |
| - < Text |
367 |
| - , FText |
368 |
| - , Rect |
369 |
| - , Circle |
370 |
| - , Line |
371 |
| - , Mosaic |
372 |
| - , Image |
373 |
| - , Poly |
374 |
| - >; |
375 |
| - |
376 |
| -using Prims = std::vector<Prim>; |
377 |
| -//! @} gapi_draw_prims |
378 |
| - |
379 | 73 | using GMat2 = std::tuple<cv::GMat,cv::GMat>;
|
380 | 74 | using GMatDesc2 = std::tuple<cv::GMatDesc,cv::GMatDesc>;
|
381 | 75 |
|
382 |
| - |
383 | 76 | //! @addtogroup gapi_draw_api
|
384 | 77 | //! @{
|
385 | 78 | /** @brief The function renders on the input image passed drawing primitivies
|
|
0 commit comments