def read_video(self):
vid = cv2.VideoCapture(self.video_path)
if vid.isOpened():
frame_count = int(vid.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))
self.predictions = np.zeros((frame_count,100,100,3))#need to know frame size
for count in xrange(frame_count):
ret,frame = vid.read() #probably don't want to get every frame
processed_frame = self.process_frame(frame)
self.predictions[count] = processed_frame
vid.release()
else:
print 'unable to open file: {}'.format(file_str)
#maybe should separate this algo, or somehow automatically detect what the model accepts
#should probably convert to float32, divide by 255.
评论列表
文章目录