zoukankan      html  css  js  c++  java
  • 用opencv+python全屏进行显示图片

    
    # -*- coding: utf-8 -*-
    """
    Created on Thu Jun 22 16:44:27 2017
    @author: sakurai
    """
     
     
    import numpy as np
    import cv2
    import screeninfo
     
    if __name__ == '__main__':
        screen_id = 2
        is_color = False
     
        # get the size of the screen
        screen = screeninfo.get_monitors()[screen_id]
        width, height = screen.width, screen.height
     
        # create image
        if is_color:
            image = np.ones((height, width, 3), dtype=np.float32)
            image[:10, :10] = 0  # black at top-left corner
            image[height - 10:, :10] = [1, 0, 0]  # blue at bottom-left
            image[:10, width - 10:] = [0, 1, 0]  # green at top-right
            image[height - 10:, width - 10:] = [0, 0, 1]  # red at bottom-right
        else:
            image = np.ones((height, width), dtype=np.float32)
            image[0, 0] = 0  # top-left corner
            image[height - 2, 0] = 0  # bottom-left
            image[0, width - 2] = 0  # top-right
            image[height - 2, width - 2] = 0  # bottom-right
     
        window_name = 'projector'
        cv2.namedWindow(window_name, cv2.WND_PROP_FULLSCREEN)
        cv2.moveWindow(window_name, screen.x - 1, screen.y - 1)
        cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN,
                              cv2.WINDOW_FULLSCREEN)
        cv2.imshow(window_name, image)
        cv2.waitKey()
        cv2.destroyAllWindows()
    
    
  • 相关阅读:
    20201130-栈与链表
    K-means算法
    支持向量机-SVC
    贝叶斯-实现新闻数据分类
    贝叶斯-使用贝叶斯实现拼写检查器
    泰坦尼克求胜率预测-基于随机森林实现
    决策树算法-Python实现
    SQL_牛客网60题
    信用卡欺诈模型-逻辑回归
    用python实习逻辑回归
  • 原文地址:https://www.cnblogs.com/enumx/p/12342413.html
Copyright © 2011-2022 走看看