Recall & Review
beginner
What does the
imshow function do in matplotlib?The
imshow function displays an image on a plot using pixel data, showing the image as it appears in an array or matrix form.Click to reveal answer
beginner
Which data types can
imshow display as images?It can display 2D arrays for grayscale images and 3D arrays for color images (like RGB), where pixel values represent brightness or color intensity.
Click to reveal answer
beginner
How do you add a color map to an image displayed with
imshow?Use the
cmap parameter in imshow, for example, imshow(image, cmap='gray') to show a grayscale color map.Click to reveal answer
intermediate
What does the
interpolation parameter control in imshow?It controls how pixel values are smoothed or stretched when the image is resized, affecting the sharpness or blur of the displayed image.
Click to reveal answer
beginner
Why might you use
plt.axis('off') after imshow?To hide the axis ticks and labels, making the image display cleaner and focusing only on the image itself.
Click to reveal answer
What type of array does
imshow expect for a color image?✗ Incorrect
imshow expects a 3D array for color images, where the last dimension represents RGB color channels.
Which parameter changes the color scheme of an image in
imshow?✗ Incorrect
The cmap parameter sets the color map for the image display.
What does
plt.axis('off') do after showing an image?✗ Incorrect
It hides the axis ticks and labels for a cleaner image display.
If you want a sharper image display with
imshow, which parameter should you adjust?✗ Incorrect
The interpolation parameter controls how pixels are smoothed or sharpened.
Which library provides the
imshow function?✗ Incorrect
imshow is part of the matplotlib.pyplot module.
Explain how to display a grayscale image using
imshow and how to remove axis labels for a cleaner look.Think about the image data shape and how to hide axes.
You got /4 concepts.
Describe the role of the
interpolation parameter in imshow and how it affects image appearance.Consider what happens when you resize an image.
You got /3 concepts.