| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c417369 commit 5d90e48
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,9 +10,6 @@ | |||
| 10 | 10 | * */ | |
| 11 | 11 | ||
| 12 | 12 | const 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 | - | ||
| 16 | 13 | "Resample input_array, blending it in-place into output_array, using an\n" | |
| 17 | 14 | "affine transformation.\n\n" | |
| 18 | 15 | ||
@@ -50,8 +47,8 @@ const char* image_resample__doc__ = | |||
| 50 | 47 | " The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN.\n"; | |
| 51 | 48 | ||
| 52 | 49 | ||
| 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) | ||
| 55 | 52 | { | |
| 56 | 53 | /* TODO: Could we get away with float, rather than double, arrays here? */ | |
| 57 | 54 | ||
@@ -90,14 +87,15 @@ static pybind11::array_t<double> _get_transform_mesh(const pybind11::object& tra | |||
| 90 | 87 | ||
| 91 | 88 | // Using generic pybind::array for input and output arrays rather than the more usual | |
| 92 | 89 | // 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) | ||
| 101 | 99 | { | |
| 102 | 100 | // Validate input_array | |
| 103 | 101 | auto dtype = input_array.dtype(); // Validated when determine resampler below | |
@@ -110,7 +108,7 @@ static void image_resample(pybind11::array input_array, | |||
| 110 | 108 | if (ndim == 3 && input_array.shape(2) != 4) { | |
| 111 | 109 | throw std::invalid_argument( | |
| 112 | 110 | "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))); | ||
| 114 | 112 | } | |
| 115 | 113 | ||
| 116 | 114 | // Ensure input array is contiguous, regardless of dtype | |
@@ -128,7 +126,7 @@ static void image_resample(pybind11::array input_array, | |||
| 128 | 126 | if (out_ndim == 3 && output_array.shape(2) != 4) { | |
| 129 | 127 | throw std::invalid_argument( | |
| 130 | 128 | "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))); | ||
| 132 | 130 | } | |
| 133 | 131 | ||
| 134 | 132 | if (!output_array.dtype().is(dtype)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | void convert_trans_affine(const pybind11::object& transform, agg::trans_affine& affine) | |
| 4 | 4 | { | |
| 5 | 5 | // If None assume identity transform so leave affine unchanged | |
| 6 | - if (transform.is(pybind11::none())) { | ||
| 6 | + if (transform.is_none()) { | ||
| 7 | 7 | return; | |
| 8 | 8 | } | |
| 9 | 9 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments