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

Function register_point_transform_projective

tools/python/src/vector.cpp:262–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260// ----------------------------------------------------------------------------------------
261
262void register_point_transform_projective(
263 py::module& m
264)
265{
266
267 py::class_<point_transform_projective>(m, "point_transform_projective",
268 "This is an object that takes 2D points and applies a projective transformation to them.")
269 .def(py::init<>(),
270"ensures \n\
271 - This object will perform the identity transform. That is, given a point \n\
272 as input it will return the same point as output. Therefore, self.m == a 3x3 identity matrix."
273 /*!
274 ensures
275 - This object will perform the identity transform. That is, given a point
276 as input it will return the same point as output. Therefore, self.m == a 3x3 identity matrix.
277 !*/
278 )
279 .def(py::init<>(&init_point_transform_projective), py::arg("m"),
280"ensures \n\
281 - self.m == m"
282 )
283 .def("__repr__", &point_transform_projective__repr__)
284 .def("__str__", &point_transform_projective__str__)
285 .def("__call__", [](const point_transform_projective& tform, const dpoint& p){return tform(p);}, py::arg("p"),
286"ensures \n\
287 - Applies the projective transformation defined by this object's constructor \n\
288 to p and returns the result. To define this precisely: \n\
289 - let p_h == the point p in homogeneous coordinates. That is: \n\
290 - p_h.x == p.x \n\
291 - p_h.y == p.y \n\
292 - p_h.z == 1 \n\
293 - let x == m*p_h \n\
294 - Then this function returns the value x/x.z"
295 /*!
296 ensures
297 - Applies the projective transformation defined by this object's constructor
298 to p and returns the result. To define this precisely:
299 - let p_h == the point p in homogeneous coordinates. That is:
300 - p_h.x == p.x
301 - p_h.y == p.y
302 - p_h.z == 1
303 - let x == m*p_h
304 - Then this function returns the value x/x.z
305 !*/
306 )
307 .def_property_readonly("m", [](const point_transform_projective& tform){numpy_image<double> tmp; assign_image(tmp,tform.get_m()); return tmp;},
308 "m is the 3x3 matrix that defines the projective transformation.")
309 .def(py::pickle(&getstate<point_transform_projective>, &setstate<point_transform_projective>));
310
311
312 m.def("inv", [](const point_transform_projective& tform){return inv(tform); }, py::arg("trans"),
313"ensures \n\
314 - If trans is an invertible transformation then this function returns a new \n\
315 transformation that is the inverse of trans. "
316 /*!
317 ensures
318 - If trans is an invertible transformation then this function returns a new
319 transformation that is the inverse of trans.

Callers 1

bind_vectorFunction · 0.85

Calls 5

pickleFunction · 0.85
argClass · 0.50
assign_imageFunction · 0.50
invFunction · 0.50
get_mMethod · 0.45

Tested by

no test coverage detected