From b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 13:19:16 +0200 Subject: Adding upstream version 1.46.3. Signed-off-by: Daniel Baumann --- ml/dlib/tools/python/src/conversion.h | 52 ----------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 ml/dlib/tools/python/src/conversion.h (limited to 'ml/dlib/tools/python/src/conversion.h') diff --git a/ml/dlib/tools/python/src/conversion.h b/ml/dlib/tools/python/src/conversion.h deleted file mode 100644 index 9ab2360a0..000000000 --- a/ml/dlib/tools/python/src/conversion.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2014 Davis E. King (davis@dlib.net) -// License: Boost Software License See LICENSE.txt for the full license. -#ifndef DLIB_PYTHON_CONVERSION_H__ -#define DLIB_PYTHON_CONVERSION_H__ - -#include "opaque_types.h" -#include -#include - -using namespace dlib; -using namespace std; - -namespace py = pybind11; - -template -void pyimage_to_dlib_image(py::object img, dest_image_type& image) -{ - if (is_gray_python_image(img)) - assign_image(image, numpy_gray_image(img)); - else if (is_rgb_python_image(img)) - assign_image(image, numpy_rgb_image(img)); - else - throw dlib::error("Unsupported image type, must be 8bit gray or RGB image."); -} - -template -void images_and_nested_params_to_dlib( - const py::object& pyimages, - const py::object& pyparams, - image_array& images, - std::vector >& params -) -{ - // Now copy the data into dlib based objects. - py::iterator image_it = pyimages.begin(); - py::iterator params_it = pyparams.begin(); - - for (unsigned long image_idx = 0; - image_it != pyimages.end() - && params_it != pyparams.end(); - ++image_it, ++params_it, ++image_idx) - { - for (py::iterator param_it = params_it->begin(); - param_it != params_it->end(); - ++param_it) - params[image_idx].push_back(param_it->cast()); - - pyimage_to_dlib_image(image_it->cast(), images[image_idx]); - } -} - -#endif // DLIB_PYTHON_CONVERSION_H__ -- cgit v1.2.3