Skip to content Skip to sidebar Skip to footer

Python Image Tutorial Works, Other Images Behaves Differently (showing Images With Pylab)

I just started experimenting with Python and image processing. I followed this very well structured tutorial: http://pythonvision.org/basic-tutorial/ . Everything in the tutorial s

Solution 1:

Most likely the image you're inputting is three channel (r,g,b) and the example image is grayscale/1-channel. Matplotlib will try to apply a colormap to a 1-channel image, but will render the three-channel as is. You can use scikit-image to downconvert:

from skimage.color importrgb2grayimg_gray= rgb2gray(img)
pylab.imshow(img_gray)

The library you're using for image processing may also have these color-conversion utilities.

Post a Comment for "Python Image Tutorial Works, Other Images Behaves Differently (showing Images With Pylab)"