mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 12:22:51 +08:00
Merge pull request #16062 from TolyaTalamanov:at/add-default-initlization-for-primitives
G-API: Add default initialization for primitives * Add ctors for primitives * Add description for constructors
This commit is contained in:
parent
b8ef2036b0
commit
0d19fa0720
@ -11,6 +11,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <opencv2/imgproc.hpp>
|
||||||
#include <opencv2/gapi.hpp>
|
#include <opencv2/gapi.hpp>
|
||||||
|
|
||||||
#include <opencv2/gapi/opencv_includes.hpp>
|
#include <opencv2/gapi/opencv_includes.hpp>
|
||||||
@ -96,6 +97,31 @@ struct freetype_font
|
|||||||
*/
|
*/
|
||||||
struct Text
|
struct Text
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Text constructor
|
||||||
|
*
|
||||||
|
* @param text_ The text string to be drawn
|
||||||
|
* @param org_ The bottom-left corner of the text string in the image
|
||||||
|
* @param ff_ The font type, see #HersheyFonts
|
||||||
|
* @param fs_ The font scale factor that is multiplied by the font-specific base size
|
||||||
|
* @param color_ The text color
|
||||||
|
* @param thick_ The thickness of the lines used to draw a text
|
||||||
|
* @param lt_ The line type. See #LineTypes
|
||||||
|
* @param bottom_left_origin_ When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner
|
||||||
|
*/
|
||||||
|
Text(const std::string& text_,
|
||||||
|
const cv::Point& org_,
|
||||||
|
int ff_,
|
||||||
|
double fs_,
|
||||||
|
const cv::Scalar& color_,
|
||||||
|
int thick_ = 1,
|
||||||
|
int lt_ = cv::LINE_8,
|
||||||
|
bool bottom_left_origin_ = false) :
|
||||||
|
text(text_), org(org_), ff(ff_), fs(fs_),
|
||||||
|
color(color_), thick(thick_), lt(lt_), bottom_left_origin(bottom_left_origin_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*@{*/
|
/*@{*/
|
||||||
std::string text; //!< The text string to be drawn
|
std::string text; //!< The text string to be drawn
|
||||||
cv::Point org; //!< The bottom-left corner of the text string in the image
|
cv::Point org; //!< The bottom-left corner of the text string in the image
|
||||||
@ -117,6 +143,22 @@ struct Text
|
|||||||
*/
|
*/
|
||||||
struct FText
|
struct FText
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief FText constructor
|
||||||
|
*
|
||||||
|
* @param text_ The text string to be drawn
|
||||||
|
* @param org_ The bottom-left corner of the text string in the image
|
||||||
|
* @param fh_ The height of text
|
||||||
|
* @param color_ The text color
|
||||||
|
*/
|
||||||
|
FText(const std::wstring& text_,
|
||||||
|
const cv::Point& org_,
|
||||||
|
int fh_,
|
||||||
|
const cv::Scalar& color_) :
|
||||||
|
text(text_), org(org_), fh(fh_), color(color_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*@{*/
|
/*@{*/
|
||||||
std::wstring text; //!< The text string to be drawn
|
std::wstring text; //!< The text string to be drawn
|
||||||
cv::Point org; //!< The bottom-left corner of the text string in the image
|
cv::Point org; //!< The bottom-left corner of the text string in the image
|
||||||
@ -132,11 +174,31 @@ struct FText
|
|||||||
*/
|
*/
|
||||||
struct Rect
|
struct Rect
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Rect constructor
|
||||||
|
*
|
||||||
|
* @param rect_ Coordinates of the rectangle
|
||||||
|
* @param color_ The bottom-left corner of the text string in the image
|
||||||
|
* @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
|
||||||
|
* @param lt_ The type of the line. See #LineTypes
|
||||||
|
* @param shift_ The number of fractional bits in the point coordinates
|
||||||
|
*/
|
||||||
|
Rect(const cv::Rect& rect_,
|
||||||
|
const cv::Scalar& color_,
|
||||||
|
int thick_ = 1,
|
||||||
|
int lt_ = cv::LINE_8,
|
||||||
|
int shift_ = 0) :
|
||||||
|
rect(rect_), color(color_), thick(thick_), lt(lt_), shift(shift_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
cv::Rect rect; //!< Coordinates of the rectangle
|
cv::Rect rect; //!< Coordinates of the rectangle
|
||||||
cv::Scalar color; //!< The rectangle color or brightness (grayscale image)
|
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, mean that the function has to draw a filled rectangle
|
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
|
||||||
int lt; //!< The type of the line. See #LineTypes
|
int lt; //!< The type of the line. See #LineTypes
|
||||||
int shift; //!< The number of fractional bits in the point coordinates
|
int shift; //!< The number of fractional bits in the point coordinates
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,12 +208,34 @@ struct Rect
|
|||||||
*/
|
*/
|
||||||
struct Circle
|
struct Circle
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Circle constructor
|
||||||
|
*
|
||||||
|
* @param center_ The center of the circle
|
||||||
|
* @param radius_ The radius of the circle
|
||||||
|
* @param color_ The color of the circle
|
||||||
|
* @param thick_ The thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn
|
||||||
|
* @param lt_ The Type of the circle boundary. See #LineTypes
|
||||||
|
* @param shift_ The Number of fractional bits in the coordinates of the center and in the radius value
|
||||||
|
*/
|
||||||
|
Circle(const cv::Point& center_,
|
||||||
|
int radius_,
|
||||||
|
const cv::Scalar& color_,
|
||||||
|
int thick_ = 1,
|
||||||
|
int lt_ = cv::LINE_8,
|
||||||
|
int shift_ = 0) :
|
||||||
|
center(center_), radius(radius_), color(color_), thick(thick_), lt(lt_), shift(shift_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
cv::Point center; //!< The center of the circle
|
cv::Point center; //!< The center of the circle
|
||||||
int radius; //!< The radius of the circle
|
int radius; //!< The radius of the circle
|
||||||
cv::Scalar color; //!< The color of the circle
|
cv::Scalar color; //!< The color of the circle
|
||||||
int thick; //!< The thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn
|
int thick; //!< The thickness of the circle outline, if positive. Negative values, like #FILLED, mean that a filled circle is to be drawn
|
||||||
int lt; //!< The Type of the circle boundary. See #LineTypes
|
int lt; //!< The Type of the circle boundary. See #LineTypes
|
||||||
int shift; //!< The Number of fractional bits in the coordinates of the center and in the radius value
|
int shift; //!< The Number of fractional bits in the coordinates of the center and in the radius value
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,12 +245,34 @@ struct Circle
|
|||||||
*/
|
*/
|
||||||
struct Line
|
struct Line
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Line constructor
|
||||||
|
*
|
||||||
|
* @param pt1_ The first point of the line segment
|
||||||
|
* @param pt2_ The second point of the line segment
|
||||||
|
* @param color_ The line color
|
||||||
|
* @param thick_ The thickness of line
|
||||||
|
* @param lt_ The Type of the line. See #LineTypes
|
||||||
|
* @param shift_ The number of fractional bits in the point coordinates
|
||||||
|
*/
|
||||||
|
Line(const cv::Point& pt1_,
|
||||||
|
const cv::Point& pt2_,
|
||||||
|
const cv::Scalar& color_,
|
||||||
|
int thick_ = 1,
|
||||||
|
int lt_ = cv::LINE_8,
|
||||||
|
int shift_ = 0) :
|
||||||
|
pt1(pt1_), pt2(pt2_), color(color_), thick(thick_), lt(lt_), shift(shift_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
cv::Point pt1; //!< The first point of the line segment
|
cv::Point pt1; //!< The first point of the line segment
|
||||||
cv::Point pt2; //!< The second point of the line segment
|
cv::Point pt2; //!< The second point of the line segment
|
||||||
cv::Scalar color; //!< The line color
|
cv::Scalar color; //!< The line color
|
||||||
int thick; //!< The thickness of line
|
int thick; //!< The thickness of line
|
||||||
int lt; //!< The Type of the line. See #LineTypes
|
int lt; //!< The Type of the line. See #LineTypes
|
||||||
int shift; //!< The number of fractional bits in the point coordinates
|
int shift; //!< The number of fractional bits in the point coordinates
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,9 +282,25 @@ struct Line
|
|||||||
*/
|
*/
|
||||||
struct Mosaic
|
struct Mosaic
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Mosaic constructor
|
||||||
|
*
|
||||||
|
* @param mos_ Coordinates of the mosaic
|
||||||
|
* @param cellSz_ Cell size (same for X, Y). Note: mos size must be multiple of cell size
|
||||||
|
* @param decim_ Decimation (0 stands for no decimation)
|
||||||
|
*/
|
||||||
|
Mosaic(const cv::Rect& mos_,
|
||||||
|
int cellSz_,
|
||||||
|
int decim_) :
|
||||||
|
mos(mos_), cellSz(cellSz_), decim(decim_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
cv::Rect mos; //!< Coordinates of the mosaic
|
cv::Rect mos; //!< Coordinates of the mosaic
|
||||||
int cellSz; //!< Cell size (same for X, Y). Note: mosaic size must be a multiple of cell size
|
int cellSz; //!< Cell size (same for X, Y). Note: mosaic size must be a multiple of cell size
|
||||||
int decim; //!< Decimation (0 stands for no decimation)
|
int decim; //!< Decimation (0 stands for no decimation)
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,9 +310,25 @@ struct Mosaic
|
|||||||
*/
|
*/
|
||||||
struct Image
|
struct Image
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Mosaic constructor
|
||||||
|
*
|
||||||
|
* @param org_ The bottom-left corner of the image
|
||||||
|
* @param img_ Image to draw
|
||||||
|
* @param alpha_ Alpha channel for image to draw (same size and number of channels)
|
||||||
|
*/
|
||||||
|
Image(const cv::Point& org_,
|
||||||
|
const cv::Mat& img_,
|
||||||
|
const cv::Mat& alpha_) :
|
||||||
|
org(org_), img(img_), alpha(alpha_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
cv::Point org; //!< The bottom-left corner of the image
|
cv::Point org; //!< The bottom-left corner of the image
|
||||||
cv::Mat img; //!< Image to draw
|
cv::Mat img; //!< Image to draw
|
||||||
cv::Mat alpha; //!< Alpha channel for image to draw (same size and number of channels)
|
cv::Mat alpha; //!< Alpha channel for image to draw (same size and number of channels)
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,11 +336,31 @@ struct Image
|
|||||||
*/
|
*/
|
||||||
struct Poly
|
struct Poly
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Mosaic constructor
|
||||||
|
*
|
||||||
|
* @param points_ Points to connect
|
||||||
|
* @param color_ The line color
|
||||||
|
* @param thick_ The thickness of line
|
||||||
|
* @param lt_ The Type of the line. See #LineTypes
|
||||||
|
* @param shift_ The number of fractional bits in the point coordinate
|
||||||
|
*/
|
||||||
|
Poly(const std::vector<cv::Point>& points_,
|
||||||
|
const cv::Scalar& color_,
|
||||||
|
int thick_ = 1,
|
||||||
|
int lt_ = cv::LINE_8,
|
||||||
|
int shift_ = 0) :
|
||||||
|
points(points_), color(color_), thick(thick_), lt(lt_), shift(shift_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@{*/
|
||||||
std::vector<cv::Point> points; //!< Points to connect
|
std::vector<cv::Point> points; //!< Points to connect
|
||||||
cv::Scalar color; //!< The line color
|
cv::Scalar color; //!< The line color
|
||||||
int thick; //!< The thickness of line
|
int thick; //!< The thickness of line
|
||||||
int lt; //!< The Type of the line. See #LineTypes
|
int lt; //!< The Type of the line. See #LineTypes
|
||||||
int shift; //!< The number of fractional bits in the point coordinate
|
int shift; //!< The number of fractional bits in the point coordinate
|
||||||
|
/*@{*/
|
||||||
};
|
};
|
||||||
|
|
||||||
using Prim = util::variant
|
using Prim = util::variant
|
||||||
|
Loading…
Reference in New Issue
Block a user