From d7644ef2b7234520ddcfe882cf37fd62c2300581 Mon Sep 17 00:00:00 2001 From: Frankie Robertson Date: Sun, 22 Nov 2020 00:07:28 +0200 Subject: [PATCH] Expose get_face_chip_details to Python (#2238) --- tools/python/src/image2.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/python/src/image2.cpp b/tools/python/src/image2.cpp index f09baab0e..76a4441a4 100644 --- a/tools/python/src/image2.cpp +++ b/tools/python/src/image2.cpp @@ -372,6 +372,11 @@ ensures \n\ .def_readwrite("rows", &chip_details::rows) .def_readwrite("cols", &chip_details::cols); + { + typedef std::vector type; + py::bind_vector(m, "chip_detailss", "An array of chip_details objects.") + .def("extend", extend_vector_with_python_list); + } m.def("extract_image_chip", &py_extract_image_chip, py::arg("img"), py::arg("chip_location")); m.def("extract_image_chip", &py_extract_image_chip, py::arg("img"), py::arg("chip_location")); @@ -447,6 +452,19 @@ ensures \n\ !*/ ); + m.def("get_face_chip_details", + static_cast(&get_face_chip_details), + py::arg("det"), py::arg("size")=200, py::arg("padding")=0.2, + "Given a full_object_detection det, returns a chip_details object which can be \n\ + used to extract an image of given size and padding." + ); + + m.def("get_face_chip_details", + static_cast (*)(const std::vector&, const unsigned long, const double)>(&get_face_chip_details), + py::arg("dets"), py::arg("size")=200, py::arg("padding")=0.2, + "Given a list of full_object_detection dets, returns a chip_details object which can be \n\ + used to extract an image of given size and padding." + ); } // ----------------------------------------------------------------------------------------