class_CameraMntr.py 文件源码

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

项目:Farmbot_GeneralAP 作者: SpongeYao 项目源码 文件源码
def connect_camera(self, arg_camera_id):
        if (self.connect):
            self.cap.release()
            print 'RELEASE...'
        self.camera_id= arg_camera_id
        print '>>> Cam ID ',self.camera_id
        self.cap= cv2.VideoCapture(self.camera_id)
        print 'cap.isOpened:', self.cap.isOpened()
        if not (self.cap.isOpened()):
            for tmp_id in self.__camera_idMatrix:
                try:
                    self.cap= cv2.VideoCapture(tmp_id)
                    print 'Cam ID ',tmp_id,': connected successfully!'
                    self.connect= True
                    self.camera_id= tmp_id
                    break
                except:
                    print 'Cam ID ',tmp_id,': connection Refused!'
                    self.connect= False
            if not(self.connect):
                tkMessageBox.showerror("Error","Connection of Camera refused!")
        else:
            self.connect= True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号