diff options
author | Anner <anner.de.jong@outlook.com> | 2018-07-03 10:33:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 10:33:15 +0900 |
commit | 000e7d4edae1fa2257f72e889e22f0f2942f8f33 (patch) | |
tree | e4ded47657ac92dd81a2b8edc0a68b19cd849a1e /numpy/core/arrayprint.py | |
parent | 9b84c1174125cb32a6be1bb6151782f8b2beda55 (diff) | |
download | numpy-000e7d4edae1fa2257f72e889e22f0f2942f8f33.tar.gz |
include warning in np.resize() docs
I find it counterintuitive that resizing a numpy array does NOT consider dimensions independent, but simply takes the first N elements of the input array that fit into the output array. I was expecting something more like `cv2.resize()` where axes are treated separately, and some form of interpolation is applied to each dimension.
numpy resizes an old 5x5x2 array into a new array with new = np.resize(old, (4, 4, 2)) by simply copying the first 4 * 4 * 2 entries from old into new. (e.g. old[0, 4, :] becomes new[1, 0, :])
This is a problem if we would like simple interpolation, or if different axes represent different entities. (If the above example is an image, the top right most pixel would get warped all the way to the left, which is most likely not the intention)
In response to my issue #11478: 'resize() is unintuitive by not treating axes separately?'
A warning in the docs might prevent some confusion.
For a discussion on the issue and a possible solution, see <https://github.com/numpy/numpy/issues/11478>
Diffstat (limited to 'numpy/core/arrayprint.py')
0 files changed, 0 insertions, 0 deletions