def read_frames(self, image_h, image_w): ''' 5. - Read video frames from `self.cap` and collect frames into list - Apply `resize()` on each frame before add it to list - Also assign frames to "self" object - Return your results ''' frames = [] while (self.cap.isOpened()): ret, cap_frame = self.cap.read() if ret == True: out = resize(cap_frame, image_h=int(image_h), image_w=int(image_w)) frames.append(out) # 5-1 /5-2 Read video and collect them # Break the loop else: break print(len(frames)) self.frames = frames # 5-3 let object have the result return frames[:] # return your results
def read_frames(self, image_h, image_w): ''' 5. - Read video frames from `self.cap` and collect frames into list - Apply `resize()` on each frame before add it to list - Also assign frames to "self" object - Return your results ''' frames = [] # 5-1 /5-2 Read video and collect them while True: ret, frame = self.cap.read() if not ret: break frames.append(resize(frame, image_h, image_w)) self.frames = frames return self.frames # return your results
def read_frames(self, image_h, image_w): ''' 5. - Read video frames from `self.cap` and collect frames into list - Apply `resize()` on each frame before add it to list - Also assign frames to "self" object - Return your results ''' frames = [] # 5-1 /5-2 Read video and collect them while (self.cap.isOpened()): ret, frame = self.cap.read() if ret == False: break frame = resize(frame, image_h, image_w) frames.append(frame) self.frames = frames # 5-3 let object have the result return self.frames # return your results