def draw_countdown(self, frame):
# Draw the count "3..".
countdown_x_offset = 1 + self.countdown # Offset from left edge
countdown_x = int(self.screenwidth -
(self.screenwidth / 5) * countdown_x_offset)
self.overlay = frame.copy()
countdown_panel_y1 = int(self.screenheight * (4. / 5))
cv2.rectangle(self.overlay, (0, countdown_panel_y1),
(self.screenwidth, self.screenheight), (224, 23, 101), -1)
cv2.addWeighted(self.overlay, OPACITY, frame,
1 - OPACITY, 0, frame)
countdown_y_offset = 20
countdown_y = int((self.screenheight * 7. / 8) + countdown_y_offset)
countdown_coord = (countdown_x, countdown_y)
draw_text(countdown_coord, frame, str(self.countdown))
return frame
评论列表
文章目录