Reading and displaying images using OpenCV

OpenCVPythonServer Side ProgrammingProgramming

In this article, we will learn how to read and display images using the OpenCV library.

OpenCV is a library of programming functions mainly aimed at real time computer vision. Before reading an image, make sure that the image is in the same directory as your program.


Step 1: Import OpenCV.
Step 2: Read an image using imread().
Step 3: Display the image using imshow().

Example Code

import cv2 as cv
image = cv.imread ('ronaldo.jpg')
cv.imshow('Cristiano Ronaldo', image)


Updated on 17-Mar-2021 08:00:05