3

See my IPython notebook here for an example and the resulting image distortion.

This old question states that it was a bug in an old version of NumPy but I am running NumPy 1.7.1 as shown. Also adding the 'r' flag to np.load() didn't change anything.

This is bizarre, since on my work computer it functions fine. I'll copy the NumPy arrays over to that computer tomorrow so I can see whether save() or load() is at fault here.

EDIT: Okay from copying over the NumPy arrays to another computer which doesn't have the issue on its own images, it is clear that it is np.save() which is causing the problem (and using basic pickle.dump() instead had the same issue). I will next investigate whether this happens for different types and sizes of arrays.

4
  • Does this happen for other types of arrays, or only for arrays created in this way? Is the array a pure numpy array, or some subclassed version? And what is the question here? Commented Feb 11, 2014 at 21:55
  • Hmm, I will check this when I get home. It seems to be a pure NumPy uint8 array of WxHx3 size (just an array of RGB values (0-255) per pixel). The problem definitely lies in np.save() doing the corruption (though pickle dumping did the same thing). The question is how to fix the corruption. Commented Feb 12, 2014 at 9:03
  • Since it appears system related, could you give us some information about the faulty machine (and also let us known whether the machine where things work correctly does have the same Python and Numpy versions as the faulty machine)? Commented Feb 12, 2014 at 9:55
  • So the faulty set-up is: Python 2.7.6 NumPy 1.7.1 The working set up is: Python 2.7.3 NumPy 1.6.1 And it doesn't appear to effect some toy example 3D uint8 numpy arrays which I created. Commented Feb 12, 2014 at 18:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.