opencv/modules/gapi/include/opencv2/gapi/render.hpp
atalaman d3c0f4ef98 Merge pull request #14700 from TolyaTalamanov:at/cv_gapi_render
G-API: Render (#14700)

* cv::Render

Implement OCVRedner for BGR as input

* Support two plane cv::Render::run

* Snapshot

* Add RenderCreator

* text2Points

* Snapshot

* Refactoring tests

* Remove text2points

* Fix render input data type in tests

* Refactoring

* Fix headers
* Change struct fields name

* Fix headers

* Fix warnings

* Replace cv::Scalar -> cv::gapi::own::Scalar

* Add test

* PutText and rectangle case

* Fix comments to review

* Fix comments to review

* Fix comments to review

* Create render_priv.hpp
* Implement BGR2NV12
* Fix NV12 test

* Fix comments to review

* Add header for GAPI_Assert
2019-06-14 18:29:49 +03:00

82 lines
2.7 KiB
C++

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
#ifndef OPENCV_GAPI_RENDER_HPP
#define OPENCV_GAPI_RENDER_HPP
#include <string>
#include <vector>
#include <opencv2/gapi/opencv_includes.hpp>
#include <opencv2/gapi/util/variant.hpp>
#include <opencv2/gapi/own/exports.hpp>
#include <opencv2/gapi/own/scalar.hpp>
namespace cv
{
namespace gapi
{
namespace wip
{
namespace draw
{
/**
* A structure to represent parameters for drawing a text string.
*/
struct Text
{
/*@{*/
std::string text; /** < The text string to be drawn */
cv::Point org; /** < The bottom-left corner of the text string in the image */
int ff; /** < The font type, see #HersheyFonts */
double fs; /** < The font scale factor that is multiplied by the font-specific base size */
cv::Scalar color; /** < The text color */
int thick; /** < The thickness of the lines used to draw a text */
int lt; /** < The line type. See #LineTypes */
bool bottom_left_origin; /** < When true, the image data origin is at the bottom-left corner. Otherwise,
it is at the top-left corner. */
/*@{*/
};
/**
* A structure to represent parameters for drawing a rectangle
*/
struct Rect
{
cv::Rect rect; /** Coordinates of the rectangle < */
cv::Scalar color; /** The rectangle color or brightness (grayscale image) < */
int thick; /** The thickness of lines that make up the rectangle. Negative values, like #FILLED, < */
int lt; /** The type of the line. See #LineTypes< */
int shift; /** The number of fractional bits in the point coordinates < */
};
using Prim = util::variant<Text, Rect>;
using Prims = std::vector<Prim>;
/** @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
*/
GAPI_EXPORTS void render(cv::Mat& bgr, const Prims& prims);
/** @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
*/
GAPI_EXPORTS void render(cv::Mat& y_plane, cv::Mat& uv_plane , const Prims& prims);
} // namespace draw
} // namespace wip
} // namespace gapi
} // namespace cv
#endif // OPENCV_GAPI_RENDER_HPP