Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scipy.ndimage.rotate() creates values outside input range #5925

Closed
makeyourownneuralnetwork opened this issue Mar 4, 2016 · 2 comments
Closed

Comments

@makeyourownneuralnetwork

I am using the scipy.ndimage.rotate() functions to rotate bumpy arrays. These arrays are in fact bitmaps of the well-known MNIST data set.

I have noticed that the resultant array has values that out outside the range of the original array.

The following python notebook at github shows this:
https://github.com/makeyourownneuralnetwork/makeyourownneuralnetwork/blob/master/part2_mnist_data_set_with_rotations.ipynb

You can see the input array had a range 0.01 to 1.00. You can then see that the rotated image has values as low as -0.095 and as high as 1.173.

This seem quite wrong!

I can understand that the underlying operations involve interpolation - but this would result in values amongst the existing values, not above or below.

I had a quick look at the source code but my skills are not high enough to spot the core problem.

@pv
Copy link
Member

pv commented Mar 4, 2016

What you are expecting is monotonic interpolation. Many image interpolation methods however are not monotonic --- eg. bicubic splines are not. With scipy.ndimage, use bilinear interpolation (order=1) if you require no overshooting.

@pv pv closed this as completed Mar 4, 2016
@makeyourownneuralnetwork
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants