MCPcopy Create free account
hub / github.com/davisking/dlib / bind_rectangles

Function bind_rectangles

tools/python/src/rectangles.cpp:93–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91// ----------------------------------------------------------------------------------------
92
93void bind_rectangles(py::module& m)
94{
95 {
96 typedef rectangle type;
97 py::class_<type>(m, "rectangle", "This object represents a rectangular area of an image.")
98 .def(py::init<long,long,long,long>(), py::arg("left"),py::arg("top"),py::arg("right"),py::arg("bottom"))
99 .def(py::init<drectangle>(), py::arg("rect"))
100 .def(py::init<rectangle>(), py::arg("rect"))
101 .def(py::init())
102 .def("area", &::area)
103 .def("left", &::left)
104 .def("top", &::top)
105 .def("right", &::right)
106 .def("bottom", &::bottom)
107 .def("width", &::width)
108 .def("height", &::height)
109 .def("tl_corner", &type::tl_corner, "Returns the top left corner of the rectangle.")
110 .def("tr_corner", &type::tr_corner, "Returns the top right corner of the rectangle.")
111 .def("bl_corner", &type::bl_corner, "Returns the bottom left corner of the rectangle.")
112 .def("br_corner", &type::br_corner, "Returns the bottom right corner of the rectangle.")
113 .def("is_empty", &::is_empty<type>)
114 .def("center", &::center<type>)
115 .def("dcenter", &::dcenter<type>)
116 .def("contains", &::contains<type,point>, py::arg("point"))
117 .def("contains", &::contains<type,dpoint>, py::arg("point"))
118 .def("contains", &::contains_xy<type>, py::arg("x"), py::arg("y"))
119 .def("contains", &::contains_rec<type>, py::arg("rectangle"))
120 .def("intersect", &::intersect<type>, py::arg("rectangle"))
121 .def("__str__", &::print_rectangle_str<type>)
122 .def("__repr__", &::print_rectangle_repr)
123 .def(py::self += point())
124 .def(py::self + point())
125 .def(py::self += rectangle())
126 .def(py::self + rectangle())
127 .def(py::self == py::self)
128 .def(py::self != py::self)
129 .def(py::pickle(&getstate<type>, &setstate<type>));
130 }
131 {
132 typedef drectangle type;
133 py::class_<type>(m, "drectangle", "This object represents a rectangular area of an image with floating point coordinates.")
134 .def(py::init<double,double,double,double>(), py::arg("left"), py::arg("top"), py::arg("right"), py::arg("bottom"))
135 .def(py::init<rectangle>(), py::arg("rect"))
136 .def(py::init<drectangle>(), py::arg("rect"))
137 .def(py::init<>())
138 .def("area", &::darea)
139 .def("left", &::dleft)
140 .def("top", &::dtop)
141 .def("right", &::dright)
142 .def("bottom", &::dbottom)
143 .def("width", &::dwidth)
144 .def("height", &::dheight)
145 .def("is_empty", &::is_empty<type>)
146 .def("center", &::center<type>)
147 .def("dcenter", &::dcenter<type>)
148 .def("tl_corner", &type::tl_corner, "Returns the top left corner of the rectangle.")
149 .def("tr_corner", &type::tr_corner, "Returns the top right corner of the rectangle.")
150 .def("bl_corner", &type::bl_corner, "Returns the bottom left corner of the rectangle.")

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 15

initFunction · 0.85
pickleFunction · 0.85
find_optimal_rect_filterFunction · 0.85
centered_rectFunction · 0.85
centered_rectsFunction · 0.85
get_measurement_noiseMethod · 0.80
centerFunction · 0.70
argClass · 0.50
pointClass · 0.50
rectangleClass · 0.50

Tested by

no test coverage detected