|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
20 #include <tiler_event_handler.hpp>
36 : NvDsTilerEventHandler(&tiler, &osd, &renderer)
45 py::module osd_module = m.def_submodule(
"osd");
56 return py::str(
self.font_name);
60 unsigned int index =
static_cast<unsigned int>(font);
69 std::string font_name_str =
self.font_name ? std::string(
self.font_name) :
"null";
70 return "Font(name=" + font_name_str +
71 ", size=" + std::to_string(
self.font_size) +
72 ", color=" + py::repr(py::cast(
self.font_color)).cast<std::string>() +
")";
75 .def(py::init<double, double, double, double>())
81 return "Color(r=" + std::to_string(
self.red) +
82 ", g=" + std::to_string(
self.green) +
83 ", b=" + std::to_string(
self.blue) +
84 ", a=" + std::to_string(
self.alpha) +
")";
88 .def_property(
"display_text",
90 [](
const Text&
self) {
91 return py::str(
self.display_text);
94 [](
Text&
self,
const string &name) {
96 self.display_text = (
char *)
self.text.c_str();
104 .def(
"__repr__", [](
const Text&
self) {
105 std::string display_text_str =
self.display_text ? std::string(
self.display_text) :
"null";
106 std::string font_name_str =
self.font_params.font_name ? std::string(
self.font_params.font_name) :
"null";
107 return "Text(display_text='" + display_text_str +
108 "', x_offset=" + std::to_string(
self.x_offset) +
109 ", y_offset=" + std::to_string(
self.y_offset) +
110 ", font_name='" + font_name_str +
111 "', font_size=" + std::to_string(
self.font_params.font_size) +
112 ", bg_color=" + py::repr(py::cast(
self.text_bg_clr)).cast<std::string>() +
")";
116 .def_property(
"display_text",
118 return py::str(
self.display_text ?
self.display_text :
"");
122 if (
self.display_text) {
123 delete[]
self.display_text;
126 self.display_text =
new char[text.length() + 1];
127 std::strcpy(
self.display_text, text.c_str());
136 return "TextParams(display_text='" + std::string(
self.display_text ?
self.display_text :
"") +
137 "', x_offset=" + std::to_string(
self.x_offset) +
138 ", y_offset=" + std::to_string(
self.y_offset) +
139 ", font_params=" + py::repr(py::cast(
self.font_params)).cast<std::string>() +
140 ", set_bg_clr=" + std::to_string(
self.set_bg_clr) +
141 ", text_bg_clr=" + py::repr(py::cast(
self.text_bg_clr)).cast<std::string>() +
")";
155 return "Rect(left=" + std::to_string(
self.left) +
156 ", top=" + std::to_string(
self.top) +
157 ", width=" + std::to_string(
self.
width) +
158 ", height=" + std::to_string(
self.height) +
159 ", rotation_angle=" + std::to_string(
self.rotation_angle) +
160 ", border_width=" + std::to_string(
self.border_width) +
161 ", border_color=" + py::repr(py::cast(
self.border_color)).cast<std::string>() +
162 ", has_bg_color=" + std::to_string(
self.has_bg_color) +
163 ", bg_color=" + py::repr(py::cast(
self.bg_color)).cast<std::string>() +
")";
168 .def_property(
"mask_array",
171 const float*
data =
self.data;
173 return py::array_t<float>();
175 return py::array_t<float>(
176 {
self.height,
self.width},
177 {
self.width *
sizeof(float),
sizeof(
float)},
183 self.data = (
float *)array.request().ptr;
184 self.size = array.size() *
sizeof(float);
185 self.height = array.shape(0);
186 self.width = array.shape(1);
190 const float*
data =
self.data;
191 py::array mask_array = py::array_t<float>();
193 mask_array = py::array_t<float>(
194 {
self.height,
self.width},
195 {
self.width *
sizeof(float),
sizeof(
float)},
199 return "Mask(height=" + std::to_string(
self.height) +
200 ", width=" + std::to_string(
self.
width) +
201 ", threshold=" + std::to_string(
self.threshold) +
202 ", mask_array=" + py::repr(mask_array).cast<std::string>() +
")";
213 return "Line(x1=" + std::to_string(
self.x1) +
214 ", y1=" + std::to_string(
self.y1) +
215 ", x2=" + std::to_string(
self.x2) +
216 ", y2=" + std::to_string(
self.y2) +
217 ", width=" + std::to_string(
self.line_width) +
218 ", color=" + py::repr(py::cast(
self.line_color)).cast<std::string>() +
")";
230 return "Arrow(x1=" + std::to_string(
self.x1) +
231 ", y1=" + std::to_string(
self.y1) +
232 ", x2=" + std::to_string(
self.x2) +
233 ", y2=" + std::to_string(
self.y2) +
234 ", width=" + std::to_string(
self.arrow_width) +
235 ", color=" + py::repr(py::cast(
self.arrow_color)).cast<std::string>() +
236 ", head=" + std::to_string(
self.arrow_head) +
")";
248 return "Circle(xc=" + std::to_string(
self.xc) +
249 ", yc=" + std::to_string(
self.yc) +
250 ", radius=" + std::to_string(
self.radius) +
251 ", color=" + py::repr(py::cast(
self.circle_color)).cast<std::string>() +
252 ", has_bg_color=" + std::to_string(
self.has_bg_color) +
253 ", bg_color=" + py::repr(py::cast(
self.bg_color)).cast<std::string>() +
254 ", width=" + std::to_string(
self.circle_width) +
")";
262 return "EventHandler(started=" + std::to_string(
self.
started) +
")";
unsigned int y1
Holds the start vertical coordinate in pixels.
Holds the box parameters of a line to be overlayed.
float threshold
Size of mask buffer in bytes.
Holds the box parameters of the box to be overlayed.
Holds the mask parameters of the segment to be overlayed.
unsigned int x2
Holds the end horizontal coordinate in pixels.
JDIMENSION JDIMENSION * width
float width
Holds the box's width in pixels.
constexpr const char * start
unsigned int arrow_width
Holds the arrow shaft width in pixels.
NvOSD_ColorParams bg_color
Holds the box's background color.
unsigned int yc
Holds the start vertical coordinate in pixels.
unsigned int y1
Holds the box's top coordinate in pixels.
constexpr const char * both
unsigned int x1
Holds the box's left coordinate in pixels.
Holds circle parameters to be overlayed.
constexpr const char * init
unsigned int font_size
Holds the size of the font.
constexpr const char * descr
double red
Holds the red component of color.
int set_bg_clr
Holds a Boolean; true if the text has a background color.
constexpr const char * descr
unsigned int line_width
Holds the box's border width in pixels.
constexpr const char * descr
unsigned int y_offset
Holds the text's vertical offset from the top left pixel of the frame.
constexpr const char * descr
@ START_HEAD
Specifies an arrow head only at start = 0.
unsigned int circle_width
Holds the circle's border width in pixels.
NvOSD_ColorParams font_color
Holds the font color.
constexpr const char * descr
NvOSD_Arrow_Head_Direction arrow_head
Holds the arrowhead position.
constexpr const char * serif
Holds arrow parameters to be overlaid.
static const char * font_table[]
unsigned int y2
Holds the end vertical coordinate in pixels.
constexpr const char * start
void module_osd_bind(py::module &m)
unsigned int radius
Holds the radius of circle in pixels.
unsigned int has_bg_color
Holds the font parameters of the text to be overlayed.
constexpr const char * descr
unsigned int x2
Holds the box's width in pixels.
double blue
Holds the blue component of color.
float rotation_angle
Holds the box's rotation angle in degrees in case of OBB.
NvOSD_ColorParams text_bg_clr
Holds the text's background color, if specified.
@ BOTH_HEAD
Specifies arrow heads at both start and end = 2.
Carrier class to handle string transfer.
float left
Holds the box's left coordinate in pixels.
NvOSD_ColorParams border_color
Holds the box's border color.
unsigned int has_bg_color
Holds a Boolean; true if the box has a background color.
constexpr const char * descr
unsigned int x_offset
Holds the text's horizontal offset from the top left pixel of the frame.
unsigned int x1
Holds the start horizontal coordinate in pixels.
NvOSD_FontParams font_params
Holds the font parameters of the text to be overlaid.
constexpr const char * descr
@ END_HEAD
Specifies an arrow head only at end = 1.
Holds parameters of text to be overlayed.
constexpr const char * descr
NvOSD_ColorParams arrow_color
Holds color parameters of the arrow box.
Holds the color parameters of the box or text to be overlayed.
float height
Holds the box's height in pixels.
Tiler event handler wrapper.
double green
Holds the green component of color.
unsigned int xc
Holds the start horizontal coordinate in pixels.
NvOSD_ColorParams circle_color
Holds the color parameters of the arrow box.
constexpr const char * started
NvOSD_ColorParams bg_color
NvOSD_ColorParams line_color
Holds the box's border color.
constexpr const char * descr
unsigned int border_width
Holds the box's border width in pixels.
float top
Holds the box's top coordinate in pixels.
constexpr const char * descr
EventHandler(Node &tiler, Node &osd, Node &renderer)
constexpr const char * stop
constexpr const char * end
constexpr const char * descr
double alpha
Holds the alpha component of color.
unsigned int y2
Holds the box's height in pixels.