RGB to grayscale
In this exercise you will load an image from scikit-image module data
and make it grayscale, then compare both of them in the output.
We have preloaded a function show_image(image, title='Image')
that displays the image using Matplotlib. You can check more about its parameters using ?show_image()
or help(show_image)
in the console.

This exercise is part of the course
Image Processing in Python
Exercise instructions
- Import the
data
andcolor
modules from Scikit image. The first module provides example images, and the second, color transformation functions. - Load the
rocket
image. - Convert the RGB-3 rocket image to grayscale.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the modules from skimage
from skimage import ____, ____
# Load the rocket image
rocket = data.____()
# Convert the image to grayscale
gray_scaled_rocket = color.____(____)
# Show the original image
show_image(rocket, 'Original RGB image')
# Show the grayscale image
show_image(gray_scaled_rocket, 'Grayscale image')