| 16 | |
| 17 | template <typename image_array, typename param_type> |
| 18 | void images_and_nested_params_to_dlib( |
| 19 | const py::object& pyimages, |
| 20 | const py::object& pyparams, |
| 21 | image_array& images, |
| 22 | std::vector<std::vector<param_type>>& params |
| 23 | ) |
| 24 | { |
| 25 | // Now copy the data into dlib based objects. |
| 26 | py::iterator image_it = pyimages.begin(); |
| 27 | py::iterator params_it = pyparams.begin(); |
| 28 | |
| 29 | for (unsigned long image_idx = 0; image_it != pyimages.end() && params_it != pyparams.end(); ++image_it, ++params_it, ++image_idx) |
| 30 | { |
| 31 | for (py::iterator param_it = params_it->begin(); param_it != params_it->end(); ++param_it) |
| 32 | params[image_idx].push_back(param_it->cast<param_type>()); |
| 33 | |
| 34 | assign_image(images[image_idx], image_it->cast<py::array>()); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | #endif // DLIB_PYTHON_CONVERSION_H__ |