def draw_annotations(self, resized_frame): frame = resized_frame point = self.annotations[0]['point'] hand = self.annotations[0]['hand'] frame = crosshead(frame, point) frame = text(frame, hand, point=point) return crosshead(frame, self.annotations[0]['point'])
def draw_annotations(self, filipped_frame): frame = filipped_frame point = self.annotations[0]['point'] hand = self.annotations[0]['hand'] flipped_point = (1 - point[0], point[1]) frame = crosshead(frame, flipped_point) frame = text(frame, hand, point=flipped_point) return frame
def draw_annotations(self, resized_frame): frame = resized_frame for annotation in self.annotations: x = annotation['x'] y = annotation['y'] frame = crosshead(frame, x, y) if annotation['label'] == 'open_pinch_top': hand = annotation['hand'] frame = text(frame, hand, point=(x, y)) return frame
def draw_annotations(self, filipped_frame): frame = filipped_frame for annotation in self.annotations: x = annotation['x'] y = annotation['y'] flipped_point = (1 - x, y) frame = crosshead(frame, *flipped_point) if annotation['label'] == 'open_pinch_top': hand = annotation['hand'] frame = text(frame, hand, point=flipped_point) return frame
def render(self, at, size=None): ix = int((at - self.started_at) * self.fps) % len(self.frames) frame = self.frames[ix] if size is not None: frame = cv2.resize(frame, size) if self.annotations is None: return frame for annotation in self.annotations[ix]: color = { 'left': LEFT_COLOR, 'right': RIGHT_COLOR }[annotation['hand']] if annotation['label'] == 'open_pinch': color = np.maximum(color, OPEN_COLOR) frame = crosshead(frame, annotation['x'], annotation['y'], color * 255) return frame