From ca7fd9d1ad2c487f5a622b7dafad4baf56db10d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= <1671644+arrufat@users.noreply.github.com> Date: Thu, 4 Apr 2024 08:26:02 +0900 Subject: [PATCH] Actually load rgb_alpha images. (#2942) This should've been added in #2925. The only doubt I have around the function name: - `load_rgb_alpha_image`: following the `rgb_alpha_pixel` in dlib - `load_rgba_image`: shorter and maybe nicer? --- tools/python/src/numpy_returns.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/python/src/numpy_returns.cpp b/tools/python/src/numpy_returns.cpp index a1aa006e3..cf6c6f21d 100644 --- a/tools/python/src/numpy_returns.cpp +++ b/tools/python/src/numpy_returns.cpp @@ -20,7 +20,7 @@ numpy_image load_rgb_image (const std::string &path) return img; } -numpy_image load_rgb_alpha_image (const std::string &path) +numpy_image load_rgb_alpha_image (const std::string &path) { numpy_image img; load_image(img, path); @@ -166,6 +166,11 @@ void bind_numpy_returns(py::module &m) py::arg("filename") ); + m.def("load_rgb_alpha_image", &load_rgb_alpha_image, + "Takes a path and returns a numpy array (RGBA) containing the image", + py::arg("filename") + ); + m.def("load_grayscale_image", &load_grayscale_image, "Takes a path and returns a numpy array containing the image, as an 8bit grayscale image.", py::arg("filename")