play.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:party-pi 作者: JustinShenk 项目源码 文件源码
def initialize_webcam(self):
        """ Initialize camera and screenwidth and screenheight.
        """
        device = 'raspberry' if 'raspberrypi' in os.uname() else None
        self.raspberry = True if 'raspberry' == device else False
        if self.piCam:
            camera = self.setup_picamera()
            self.piCamera = camera
            return

        cam = cv2.VideoCapture(0)
        frame = None
        while frame is None:
            try:
                _, frame = cam.read()
                # Update class variables.
                self.screenheight, self.screenwidth = frame.shape[:2]
                cam.set(3, self.screenwidth)
                cam.set(4, self.screenheight)
            except:
                pass
        self.cam = cam
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号