January 2018
Intermediate to advanced
268 pages
6h 20m
English
Let's see how we can load an image in OpenCV-Python. Create a file named first_program.py and open it in your favorite code editor. Create a folder named images in the current folder, and make sure that you have an image named input.jpg in that folder.
Once you do that, add the following lines to that Python file:
import cv2img = cv2.imread('./images/input.jpg')
cv2.imshow('Input image', img)cv2.waitKey()
If you run the preceding program, you will see an image being displayed in a new window.
Read now
Unlock full access