Syntax error Reading and displaying images using OpenCV

Reading and displaying images using OpenCV



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.

Algorithm

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)

Output

Updated on: 2021-03-17T08:00:05+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements