On Fri, Feb 27, 2015 at 10:33 PM, Sturla Molden <sturla.molden@gmail.com> wrote:

>

> Somewhere... But where is it?

>

> NumPy, SciPy, Matplotlib, Cython or ipython?

>

> I am suspecting ipython, but proving it is hard...

>

> http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/12464039/lenna-bug.ipynb

When plt.imshow() is given floating point RGB images, it assumes that each channel is normalized to 1. You are mixing a 0..255 image with a 0..1 image. Divide `lenna` by 255.0 before you stack it with `_dct`. Or multiply `_dct` by 255 and cast it to uint8.

--

Robert Kern

>

> Somewhere... But where is it?

>

> NumPy, SciPy, Matplotlib, Cython or ipython?

>

> I am suspecting ipython, but proving it is hard...

>

> http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/12464039/lenna-bug.ipynb

When plt.imshow() is given floating point RGB images, it assumes that each channel is normalized to 1. You are mixing a 0..255 image with a 0..1 image. Divide `lenna` by 255.0 before you stack it with `_dct`. Or multiply `_dct` by 255 and cast it to uint8.

--

Robert Kern