Python | cv2 imshow() Method

In this tutorial, we will see how to display an image as an output using python by the use of open-cv which is exist as cv2 (computer vision) library.

We can use imshow() method of cv2 library to display an image in a window. In order to use cv2 library, we need to import cv2 library using import statement.

Now let’s see the syntax and return value of cv2 imshow() method, then we will move on the examples.

Syntax

Parameters

You need to pass two parameters to imwrite() method. Parameters are:
1) win_name: Name of the window in which the image will be displayed.
2) image: Image pixel matrix of that image, which will need to be shown.

Return Value

None

Return value

Let’s see the python code :

Output :

Output1

As you can see, a window is opened to display the image. Window size is dependent on size of the image. If window size is greater than screen resolution, then it displays scaled version of the image.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *