Read and Display an Image in a Window Using Python OpenCV

In this tutorial, we will introduce you how to read an image then show it in a window using python opencv.

1. Import library

import cv2

2. Read an image

my_img = cv2.imread("imgs/pd2.jpg", cv2.IMREAD_COLOR)

3. Show an image in a window

cv2.imshow("Display image", my_img)

where “Display image” is the name of window.