cv2.imshow图像窗口放置在可见屏幕之外 [英] cv2.imshow image window placement is outside of viewable screen

查看:1082
本文介绍了cv2.imshow图像窗口放置在可见屏幕之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从menpo运行python35的Anaconda安装和cv2安装. 我遇到cv2.imshow()在将类似于下面的代码作为独立脚本和控制台中的命令行(cmd,spyder,ipython)逐行运行时,不一致地将图像窗口放置在可视屏幕之外的问题...

I am running Anaconda install of python35 with cv2 install from menpo. I am having trouble with cv2.imshow() inconsistently placing the image window outside of the viewable screen when running code similar to the one below both as a standalone script and line by line in the console (cmd, spyder, ipython)...

import cv2
img = cv2.imread('Image71.jpg',0)
cv2.startWindowThread()
cv2.namedWindow('image')
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

我也尝试了不带cv2.starWindowThread()cv2.namedWindow()的上述方法,但结果相同.该窗口显示在我的任务栏上,但没有显示在窗口中,cv2.waitKey(0)响应按键,并且我无法使用Windows 10的任何窗口排列快捷键(例如alt + tab,Winkey +左等). 我的操作系统是Win10版本1709. 非常感谢您的帮助!

I have also tried the above without cv2.starWindowThread() and cv2.namedWindow() with the same result. The window appears on my taskbar but is not in view, cv2.waitKey(0) responds to the keystroke, and I am not able to bring the window into view using any of the window arrangement shortcut keys for Windows 10 (e.g. alt+tab, Winkey + left, etc). My OS is Win10 version 1709. Any help is much appreciated, thx!

推荐答案

img = cv2.imread("test.png")
winname = "Test"
cv2.namedWindow(winname)        # Create a named window
cv2.moveWindow(winname, 40,30)  # Move it to (40,30)
cv2.imshow(winname, img)
cv2.waitKey()
cv2.destroyAllWindows()

这篇关于cv2.imshow图像窗口放置在可见屏幕之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆