0
0
Computer Visionml~5 mins

Displaying images (cv2.imshow, matplotlib) in Computer Vision - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does cv2.imshow() do in image processing?

cv2.imshow() opens a window to display an image using OpenCV. It shows the image until a key is pressed.

Click to reveal answer
beginner
How do you display an image using matplotlib?

Use plt.imshow() to show the image and plt.show() to display the window with the image.

Click to reveal answer
intermediate
Why might images look different when displayed with cv2.imshow() vs matplotlib.pyplot.imshow()?

OpenCV uses BGR color order, while matplotlib uses RGB. Without converting colors, images may look strange in matplotlib.

Click to reveal answer
beginner
What function is used to wait for a key press in OpenCV after showing an image?

cv2.waitKey() pauses the program and waits for a key press. It is needed to keep the image window open.

Click to reveal answer
beginner
How do you close all OpenCV image windows programmatically?

Use cv2.destroyAllWindows() to close all windows opened by OpenCV.

Click to reveal answer
Which function displays an image in a window using OpenCV?
Aplt.showimage()
Bplt.imshow()
Ccv2.showimage()
Dcv2.imshow()
What must you call after cv2.imshow() to keep the window open until a key is pressed?
Acv2.waitKey()
Bplt.show()
Ccv2.destroyAllWindows()
Dcv2.close()
Why do images sometimes appear with wrong colors in matplotlib after loading with OpenCV?
AOpenCV loads images in BGR format, matplotlib expects RGB
BMatplotlib cannot display color images
COpenCV images are grayscale only
DMatplotlib requires images in grayscale
Which matplotlib function actually shows the image window?
Acv2.imshow()
Bplt.show()
Cplt.imshow()
Dplt.display()
How do you close all OpenCV windows after displaying images?
Acv2.closeAll()
Bplt.close()
Ccv2.destroyAllWindows()
Dcv2.closeWindows()
Explain how to display an image using OpenCV and keep the window open until a key is pressed.
Think about the functions needed to show and pause the image window.
You got /4 concepts.
    Describe the difference in color formats between OpenCV and matplotlib and how to fix color issues when displaying images.
    Consider how OpenCV loads colors and what matplotlib expects.
    You got /4 concepts.