You can display an image in Python using CV2 by following the given code. I highly recommend you get the “Computer Vision: Models, Learning, and Inference Book” to learn Computer Vision.
If OpenCV library is not installed, then first install it using this code.
pip install opencv-python
The image should be in the same folder in which the code file is running. Otherwise, add the location before the image name.
# Import the OpenCV library import cv2 # Read the Image image = cv2.imread('man.jpg') # Display the Image cv2.imshow('man_image',image) # Destroy the Window cv2.waitKey(0) cv2.destroyAllWindows()