in source/frontend/video_capture.py [0:0]
def read(self):
# clear buffer of VideoCapture
for i in range(5):
self.cap.grab()
ret, frame = self.cap.read()
if ret is False or frame is None:
return None
# crop
cx = frame.shape[1] / 2
cy = frame.shape[0] / 2
frame_ = frame[int(cy-self.CROPPED_IMAGE_HEIGHT/2):int(cy+self.CROPPED_IMAGE_HEIGHT/2),
int(cx-self.CROPPED_IMAGE_WIDTH/2):int(cx+self.CROPPED_IMAGE_WIDTH/2)]
return frame_