def read(self,training=False,validation=False):
pos=int(self.currpos)
ret,image=self.video.read()
count=0
while True:
if ret:
self.currpos+=1
update=False
else:
self.currpos=0
update=True
if update:
self.video.set(cv.CV_CAP_PROP_POS_FRAMES,self.currpos)
if ret and (validation and is_validation_frame(pos) or training and is_training_frame(pos) or not training and not validation):
return ret,image,pos
else:
pos=int(self.currpos)
ret,image=self.video.read()
count+=1
if count>=1000:
print 'read retry timeout'
os._exit(-1)
评论列表
文章目录