如何使用python2.7和opencv2.4显示全屏图像 [英] how to display a full screen images with python2.7 and opencv2.4

查看:260
本文介绍了如何使用python2.7和opencv2.4显示全屏图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python和opencv创建一种图像播放器.我显示的图像在屏幕上具有相同的分辨率,我希望在全屏模式下无边框地显示它们(底部没有窗口栏,顶部没有图像栏).

I am trying to create a sort of image player with python and opencv. The images that i show are the same resolution on my screen and i would like to display them bordless in a full screen mode (without the windows bar at the bottom and the image bar at the top).

我也接受建议以改善我的"var",该计数器用于显示图像:)

I accept also advice in order to improve my "var" used a counter for displaying the images:)

谢谢

def main():
    var= 0
    while True:
        print 'loading images...'
        if var==0:
            img =  cv2.imread('2-c.jpg')
            var=var+1
        else:
            img =  cv2.imread('2-d.jpg')
        cv2.imshow("test",img)
        key=cv2.waitKey(0)
        if key==27:
            break

我张贴一张图片,也许我可以更好地解释自己: 如您所见,顶部仍然有蓝色栏

I post an image and maybe i can explain myself better: as you can see there is still the blue bar on top

推荐答案

这是我最后做的事情:

cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
cv2.imshow("window", img)

这篇关于如何使用python2.7和opencv2.4显示全屏图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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