| 136 | // ---------------------------------------------------------------------------------------- |
| 137 | |
| 138 | void register_hough_transform(py::module& m) |
| 139 | { |
| 140 | const char* class_docs = |
| 141 | "This object is a tool for computing the line finding version of the Hough transform \n\ |
| 142 | given some kind of edge detection image as input. It also allows the edge pixels \n\ |
| 143 | to be weighted such that higher weighted edge pixels contribute correspondingly \n\ |
| 144 | more to the output of the Hough transform, allowing stronger edges to create \n\ |
| 145 | correspondingly stronger line detections in the final Hough transform."; |
| 146 | |
| 147 | |
| 148 | const char* doc_constr = |
| 149 | "requires \n\ |
| 150 | - ``size_`` > 0 \n\ |
| 151 | ensures \n\ |
| 152 | - This object will compute Hough transforms that are ``size_`` by ``size_`` pixels. \n\ |
| 153 | This is in terms of both the Hough accumulator array size as well as the \n\ |
| 154 | input image size. \n\ |
| 155 | - size() == ``size_``"; |
| 156 | /*! |
| 157 | requires |
| 158 | - size_ > 0 |
| 159 | ensures |
| 160 | - This object will compute Hough transforms that are size_ by size_ pixels. |
| 161 | This is in terms of both the Hough accumulator array size as well as the |
| 162 | input image size. |
| 163 | - size() == size_ |
| 164 | !*/ |
| 165 | |
| 166 | py::class_<hough_transform>(m, "hough_transform", class_docs) |
| 167 | .def(py::init<unsigned long>(), doc_constr, py::arg("size_")) |
| 168 | .def_property_readonly("size", &hough_transform::size, |
| 169 | "returns the size of the Hough transforms generated by this object. In particular, this object creates Hough transform images that are size by size pixels in size.") |
| 170 | .def("get_line", &ht_get_line<long>, py::arg("p")) |
| 171 | .def("get_line", &ht_get_line<double>, py::arg("p"), |
| 172 | "requires \n\ |
| 173 | - rectangle(0,0,size-1,size-1).contains(p) == true \n\ |
| 174 | (i.e. p must be a point inside the Hough accumulator array) \n\ |
| 175 | ensures \n\ |
| 176 | - returns the line segment in the original image space corresponding \n\ |
| 177 | to Hough transform point p. \n\ |
| 178 | - The returned points are inside rectangle(0,0,size-1,size-1).") |
| 179 | /*! |
| 180 | requires |
| 181 | - rectangle(0,0,size-1,size-1).contains(p) == true |
| 182 | (i.e. p must be a point inside the Hough accumulator array) |
| 183 | ensures |
| 184 | - returns the line segment in the original image space corresponding |
| 185 | to Hough transform point p. |
| 186 | - The returned points are inside rectangle(0,0,size-1,size-1). |
| 187 | !*/ |
| 188 | |
| 189 | .def("get_line_angle_in_degrees", &ht_get_line_angle_in_degrees<long>, py::arg("p")) |
| 190 | .def("get_line_angle_in_degrees", &ht_get_line_angle_in_degrees<double>, py::arg("p"), |
| 191 | "requires \n\ |
| 192 | - rectangle(0,0,size-1,size-1).contains(p) == true \n\ |
| 193 | (i.e. p must be a point inside the Hough accumulator array) \n\ |
| 194 | ensures \n\ |
| 195 | - returns the angle, in degrees, of the line corresponding to the Hough \n\ |
no test coverage detected