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

Function py_extract_image_4points

tools/python/src/image2.cpp:77–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76template <typename T>
77numpy_image<T> py_extract_image_4points (
78 const numpy_image<T>& img,
79 const py::list& corners,
80 long rows,
81 long columns
82)
83{
84 DLIB_CASSERT(rows >= 0);
85 DLIB_CASSERT(columns >= 0);
86 DLIB_CASSERT(len(corners) == 4);
87
88 numpy_image<T> out;
89 set_image_size(out, rows, columns);
90 try
91 {
92 extract_image_4points(img, out, python_list_to_array<dpoint,4>(corners));
93 return out;
94 }
95 catch (py::cast_error&){}
96
97 try
98 {
99 extract_image_4points(img, out, python_list_to_array<line,4>(corners));
100 return out;
101 }
102 catch(py::cast_error&)
103 {
104 throw dlib::error("extract_image_4points() requires the corners argument to be a list of 4 dpoints or 4 lines.");
105 }
106}
107
108// ----------------------------------------------------------------------------------------
109

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
extract_image_4pointsFunction · 0.85
errorClass · 0.85
set_image_sizeFunction · 0.50

Tested by

no test coverage detected