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

Function py_find_projective_transform2

tools/python/src/vector.cpp:235–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233
234template <typename T>
235point_transform_projective py_find_projective_transform2 (
236 const numpy_image<T>& from_points_,
237 const numpy_image<T>& to_points_
238)
239{
240 const_image_view<numpy_image<T>> from_points(from_points_);
241 const_image_view<numpy_image<T>> to_points(to_points_);
242
243 DLIB_CASSERT(from_points.nc() == 2 && to_points.nc() == 2,
244 "Both from_points and to_points must be arrays with 2 columns.");
245 DLIB_CASSERT(from_points.nr() == to_points.nr(),
246 "from_points and to_points must have the same number of rows.");
247 DLIB_CASSERT(from_points.nr() >= 4,
248 "You need at least 4 rows in the input matrices to find a projective transform.");
249
250 std::vector<dpoint> from, to;
251 for (long r = 0; r < from_points.nr(); ++r)
252 {
253 from.push_back(dpoint(from_points[r][0], from_points[r][1]));
254 to.push_back(dpoint(to_points[r][0], to_points[r][1]));
255 }
256
257 return find_projective_transform(from, to);
258}
259
260// ----------------------------------------------------------------------------------------
261

Callers

nothing calls this directly

Calls 4

ncMethod · 0.45
nrMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected