简体   繁体   English

OpenCV:调整大小窗口不起作用

[英]Opencv: resizing window does not work

cv2.namedWindow('output',cv2.WINDOW_NORMAL)
cv2.namedWindow('input',cv2.WINDOW_NORMAL)
cv2.resizeWindow("input", 50, 50)
cv2.resizeWindow("output", 50, 50)

The above simply does not work... No matter how I change the width and height of the cv2.resizeWindow the two windows are simply way too big to fit into the screen. 上面的方法根本行不通...无论我如何更改cv2.resizeWindow的宽度和高度,两个窗口都太大了,无法容纳在屏幕上。 Changing the window_normal to window_autosize does not work either.. 将window_normal更改为window_autosize也不起作用。

Maybe an undefined flag problem, try changing this: 可能是未定义的标志问题,请尝试更改以下内容:

cv2.namedWindow('output',cv2.WINDOW_NORMAL)
cv2.namedWindow('input',cv2.WINDOW_NORMAL)

To

cv2.namedWindow("output",0)
cv2.namedWindow("input",0)

Sorry this was a very stupid mistake. 抱歉,这是一个非常愚蠢的错误。 I accidentally destroyed the window I created before calling cv2.imshow. 我不小心破坏了我在调用cv2.imshow之前创建的窗口。 I guess the lesson learnt from here is that you can call cv2.imshow without calling cv2.namedwindow first, but by default the size may be not what you want.. 我想从这里学到的教训是您可以调用cv2.imshow而不先调用cv2.namedwindow,但是默认情况下大小可能不是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM