本文整理匯總了Python中imutils.video.FileVideoStream方法的典型用法代碼示例。如果您正苦於以下問題:Python video.FileVideoStream方法的具體用法?Python video.FileVideoStream怎麽用?Python video.FileVideoStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類imutils.video
的用法示例。
在下文中一共展示了video.FileVideoStream方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: open
# 需要導入模塊: from imutils import video [as 別名]
# 或者: from imutils.video import FileVideoStream [as 別名]
def open(self):
if opt.input_type == 'webcam':
self.vdo = FileVideoStream(opt.webcam_ind).start()
elif opt.input_type == 'ipcam':
# load cam key, secret
with open("cam_secret.txt") as f:
lines = f.readlines()
key = lines[0].strip()
secret = lines[1].strip()
self.vdo = FileVideoStream(opt.ipcam_url.format(key, secret, opt.ipcam_no)).start()
# video
else :
assert os.path.isfile(opt.vid_path), "Error: path error"
self.vdo = FileVideoStream(opt.vid_path).start()
self.im_width = int(self.vdo.stream.get(cv2.CAP_PROP_FRAME_WIDTH))
self.im_height = int(self.vdo.stream.get(cv2.CAP_PROP_FRAME_HEIGHT))
self.area = 0, 0, self.im_width, self.im_height
if self.write_video:
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
self.output = cv2.VideoWriter("demo1.avi", fourcc, 20, (self.im_width, self.im_height))
#return self.vdo.isOpened()