Ask Your Question
0

Resizing the output window of imshow function

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

Dr Dre gravatar image

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

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')
    cv2.imshow('image',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

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
6

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

Guyygarty gravatar image

You need to implicitly create the window with the WINDOW_NORMAL flag

cv2.namedWindow('image',WINDOW_NORMAL)

you ca then resize it using e.g.

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

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

guy

edit flag offensive delete link more

Comments

2

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 -0600 )edit
2

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 -0600 )edit

heyy sir thank you very much it's working

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

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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 237,440 times

Last updated: Jan 22 '16