1010 * */
1111
1212const char * image_resample__doc__ =
13- " resample(input_array, output_array, transform, interpolation=NEAREST, resample=False, alpha=1.0, norm=False, radius=1.0)\n "
14- " --\n\n "
15-
1613" Resample input_array, blending it in-place into output_array, using an\n "
1714" affine transformation.\n\n "
1815
@@ -50,8 +47,8 @@ const char* image_resample__doc__ =
5047" The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN.\n " ;
5148
5249
53- static pybind11::array_t <double > _get_transform_mesh ( const pybind11::object& transform,
54- const pybind11::ssize_t *dims)
50+ static pybind11::array_t <double >
51+ _get_transform_mesh ( const pybind11::object& transform, const pybind11::ssize_t *dims)
5552{
5653 /* TODO: Could we get away with float, rather than double, arrays here? */
5754
@@ -90,14 +87,15 @@ static pybind11::array_t<double> _get_transform_mesh(const pybind11::object& tra
9087
9188// Using generic pybind::array for input and output arrays rather than the more usual
9289// pybind::array_t<type> as function supports multiple array dtypes.
93- static void image_resample (pybind11::array input_array,
94- pybind11::array& output_array,
95- const pybind11::object& transform,
96- interpolation_e interpolation,
97- bool resample_, // Avoid name clash with resample() function
98- float alpha,
99- bool norm,
100- float radius)
90+ static void
91+ image_resample (pybind11::array input_array,
92+ pybind11::array& output_array,
93+ const pybind11::object& transform,
94+ interpolation_e interpolation,
95+ bool resample_, // Avoid name clash with resample() function
96+ float alpha,
97+ bool norm,
98+ float radius)
10199{
102100 // Validate input_array
103101 auto dtype = input_array.dtype (); // Validated when determine resampler below
@@ -110,7 +108,7 @@ static void image_resample(pybind11::array input_array,
110108 if (ndim == 3 && input_array.shape (2 ) != 4 ) {
111109 throw std::invalid_argument (
112110 " 3D input array must be RGBA with shape (M, N, 4), has trailing dimension of " +
113- std::to_string (ndim ));
111+ std::to_string (input_array. shape ( 2 ) ));
114112 }
115113
116114 // Ensure input array is contiguous, regardless of dtype
@@ -128,7 +126,7 @@ static void image_resample(pybind11::array input_array,
128126 if (out_ndim == 3 && output_array.shape (2 ) != 4 ) {
129127 throw std::invalid_argument (
130128 " 3D output array must be RGBA with shape (M, N, 4), has trailing dimension of " +
131- std::to_string (out_ndim ));
129+ std::to_string (output_array. shape ( 2 ) ));
132130 }
133131
134132 if (!output_array.dtype ().is (dtype)) {
0 commit comments