![]() |
VOOZH | about |
The cv2.imshow() function in OpenCV is used to display an image in a window. It creates a window with a specified name and shows the given image. This function is commonly used to view images and verify image processing results.
For this article, a sample image is used name "logo.png", which is displayed below:
Example: In this example, the sample image is loaded and displayed in a window.
Output
Explanation:
cv2.imshow(window_name, image)
Parameters:
Example 1: In this example, an image is loaded in grayscale mode and displayed.
Output: The grayscale image is displayed in a window.
Explanation:
Example 2: In this example, the image is resized before displaying it.
Output: resized image (300×300) is displayed.
Explanation:
Example 3: The same image is displayed in two different windows with different window names. This shows how cv2.imshow() can create multiple display windows.
Output: The same image is displayed in two separate windows named "Window 1" and "Window 2".
Explanation: