MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / ExportOSD

Function ExportOSD

python/mod_cvcuda/OsdElement.cpp:119–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void ExportOSD(py::module &m)
120{
121 using namespace py::literals;
122 using namespace cvcuda::priv;
123
124 py::class_<NVCVBndBoxI>(m, "BndBoxI", "BndBoxI")
125 .def(py::init(
126 [](py::tuple box, int thickness, py::tuple borderColor, py::tuple fillColor)
127 {
128 NVCVBndBoxI bndbox;
129 bndbox.box = pytobox(box);
130 bndbox.thickness = thickness;
131 bndbox.borderColor = pytocolor(borderColor);
132 bndbox.fillColor = pytocolor(fillColor);
133 return bndbox;
134 }),
135 "box"_a, "thickness"_a, "borderColor"_a, "fillColor"_a)
136 .def_readonly("box", &NVCVBndBoxI::box, "Tuple describing a box: x-coordinate, y-coordinate, width, height.")
137 .def_readonly("thickness", &NVCVBndBoxI::thickness, "Border thickness of bounding box.")
138 .def_readonly("borderColor", &NVCVBndBoxI::borderColor, "Border color of bounding box.")
139 .def_readonly("fillColor", &NVCVBndBoxI::fillColor, "Filled color of bounding box.");
140
141 py::class_<NVCVBndBoxesImpl, std::shared_ptr<NVCVBndBoxesImpl>>(m, "BndBoxesI")
142 .def(py::init([](const std::vector<std::vector<NVCVBndBoxI>> &bndboxes_vec)
143 { return std::make_shared<NVCVBndBoxesImpl>(bndboxes_vec); }),
144 "boxes"_a);
145
146 py::class_<NVCVText, std::shared_ptr<NVCVText>>(m, "Label")
147 .def(py::init(
148 [](const char *utf8Text, int32_t fontSize, const char *fontName, py::tuple tlPos, py::tuple fontColor,
149 py::tuple bgColor) {
150 return NVCVText(utf8Text, fontSize, fontName, pytopoint(tlPos), pytocolor(fontColor),
151 pytocolor(bgColor));
152 }),
153 "utf8Text"_a, "fontSize"_a, py::arg("fontName") = "DejaVuSansMono", "tlPos"_a, "fontColor"_a, "bgColor"_a);
154
155 py::class_<NVCVSegment>(m, "Segment")
156 .def(py::init(
157 [](py::tuple box, int32_t thickness, py::array_t<float> segArray, float segThreshold,
158 py::tuple borderColor, py::tuple segColor)
159 {
160 py::buffer_info hSeg = segArray.request();
161 if (hSeg.ndim != 2)
162 {
163 throw std::runtime_error("segArray dims must be 2!");
164 }
165
166 return NVCVSegment(pytobox(box), thickness, (float *)hSeg.ptr, hSeg.shape[0], hSeg.shape[1],
167 segThreshold, pytocolor(borderColor), pytocolor(segColor));
168 }),
169 "box"_a, "thickness"_a, "segArray"_a, "segThreshold"_a, "borderColor"_a, "segColor"_a);
170
171 py::class_<NVCVPoint>(m, "Point", "Point")
172 .def(py::init(
173 [](py::tuple centerPos, int32_t radius, py::tuple color)
174 {
175 NVCVPoint point;
176 point.centerPos = pytopoint(centerPos);

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 10

pytoboxFunction · 0.85
pytocolorFunction · 0.85
NVCVTextClass · 0.85
pytopointFunction · 0.85
NVCVSegmentClass · 0.85
NVCVPolyLineClass · 0.85
NVCVClockClass · 0.85
valueMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected