Converted image not displaying

I'm trying to convert a color image to a grayscale image, as follows: from skimage import iofrom skimage.color import rgb2gray img = io.imread('baboon.png') img_grayscale = rgb2gray(img) io.imshow(img_grayscale) The code works fine, but the image does not get displayed, why is that? Thanks.

Do io.show() for the image to pop up. It's similar to the matplotlib drawing where you first draw and then show. You can also use skimage.viewer.ImageViewer to view the image. Although, I actually don't know why simply imshow did not pop out the image in the viewer. On Thu, Jan 21, 2016 at 5:16 PM, Abder-Rahman Ali < abder.rahman.ali@gmail.com> wrote:
I'm trying to convert a color image to a grayscale image, as follows:
from skimage import iofrom skimage.color import rgb2gray img = io.imread('baboon.png') img_grayscale = rgb2gray(img) io.imshow(img_grayscale)
The code works fine, but the image does not get displayed, why is that?
Thanks.
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. To post to this group, send email to scikit-image@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/2e444147-2d96-4100-87fd-e375f... <https://groups.google.com/d/msgid/scikit-image/2e444147-2d96-4100-87fd-e375fd737494%40googlegroups.com?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout.
-- Himanshu Mishra

Did you try addind io.show() at the end of your script? Cheers, Emmanuelle On Thu, Jan 21, 2016 at 03:46:10AM -0800, Abder-Rahman Ali wrote:
I'm trying to convert a color image to a grayscale image, as follows:
from skimage import io from skimage.color import rgb2gray img = io.imread('baboon.png') img_grayscale = rgb2gray(img) io.imshow(img_grayscale)
The code works fine, but the image does not get displayed, why is that?
Thanks.

Thanks a lot for your replies. The code that works for me looks as follows: import skimage.io as io from skimage.color import rgb2gray img = io.imread('baboon.png') img_grayscale = rgb2gray(img) show_grayscale = io.imshow(img_grayscale) io.show() On Thursday, January 21, 2016 at 12:46:10 PM UTC+1, Abder-Rahman Ali wrote:
I'm trying to convert a color image to a grayscale image, as follows:
from skimage import iofrom skimage.color import rgb2gray img = io.imread('baboon.png') img_grayscale = rgb2gray(img) io.imshow(img_grayscale)
The code works fine, but the image does not get displayed, why is that?
Thanks.
participants (3)
-
Abder-Rahman Ali
-
Emmanuelle Gouillart
-
Himanshu Mishra