In this project, I will show you how to display an image using OpenCV.
You Will Need
- Python 3.7+
Let’s say you have an image like the one below. The file name is 1.jpg.
To display it using OpenCV, go to your favorite IDE or text editor and create the following Python program:
# Display a color image using OpenCV import numpy as np import cv2 # Load an color image in grayscale img = cv2.imread('1.jpg',1) cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows()
Save the program into the same directory as 1.jpg.
Run the file.
Watch the image display to your computer. That’s it!