Ask Your Question

Resizing the output window of imshow function

asked 2016-01-22 07:55:31 -0500

Dr Dre gravatar image

updated 2016-01-22 08:44:48 -0500

Hi Guys

I have an image with 6000 * 6000 pixels as shown

link of image

When I run the following code

    import cv2
    img = cv2.imread('Test.jpg')

It wont display the entire image in the output but a part of it .

How do i make the imshow function display the entire image in its output window ?

I am using open cv2 and python 2.7

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-22 08:37:12 -0500

Guyygarty gravatar image

You need to implicitly create the window with the WINDOW_NORMAL flag


you ca then resize it using e.g.

cv2.resizeWindow('image', 600,600)

(this should give a 10x demagnification of your image).


edit flag offensive delete link more



Sir its cv2.namedWindow('image',cv2.WINDOW_NORMAL) not cv2.namedWindow('image',WINDOW_NORMAL)

But anyways that worked .. Thank U GUY

Dr Dre gravatar imageDr Dre ( 2016-01-22 08:46:31 -0500 )edit

no problem.

I don't use the python interface, so I tried to extrapolate from what I use in C++.

Guyygarty gravatar imageGuyygarty ( 2016-01-22 10:10:33 -0500 )edit

heyy sir thank you very much it's working

jv_18 gravatar imagejv_18 ( 2018-06-11 01:03:21 -0500 )edit

Great answer! Thanks!

Maybe it's necessary for someone to know: In Python the new window size must be handled as tuple of integer width and integer height. cv2.resizeWindow(window_name, (new_width, new_height))

smoosbau gravatar imagesmoosbau ( 2018-11-23 04:37:53 -0500 )edit

Question Tools

1 follower


Asked: 2016-01-22 07:55:31 -0500

Seen: 203,730 times

Last updated: Jan 22 '16