pull/16438/head
RizwanMunawar 5 months ago
parent e265320379
commit fe4529368a
  1. 51
      ultralytics/utils/plotting.py

@ -695,33 +695,30 @@ class Annotator:
cv2.circle(self.im, (int(x_coord), int(y_coord)), radius, (0, 255, 0), -1, lineType=cv2.LINE_AA) cv2.circle(self.im, (int(x_coord), int(y_coord)), radius, (0, 255, 0), -1, lineType=cv2.LINE_AA)
return self.im return self.im
# def plot_workout_information(self, display_text, position, color, txt_color): def plot_workout_information(self, display_text, position, color=(104, 31, 17), txt_color=(255, 255, 255)):
# """ """
# Draw text with a background on the image. Draw text with a background on the image.
#
# Args: Args:
# display_text (str): The text to be displayed. display_text (str): The text to be displayed.
# position (tuple): Coordinates (x, y) on the image where the text will be placed. position (tuple): Coordinates (x, y) on the image where the text will be placed.
# color (tuple): Background color of the text. Default is (104, 31, 17). color (tuple, optional): Text background color
# txt_color (tuple): Text color. Default is (255, 255, 255). txt_color (tuple, optional): Text foreground color
# """
# Returns: (text_width, text_height), _ = cv2.getTextSize(display_text, 0, self.sf, self.tf)
# text_height: (float): height of the text, used for positioning other elements.
# """ # Draw background rectangle
# (text_width, text_height), _ = cv2.getTextSize(display_text, 0, self.sf, self.tf) cv2.rectangle(
# self.im,
# # Draw background rectangle (position[0], position[1] - text_height - 5),
# cv2.rectangle( (position[0] + text_width + 10, position[1] - text_height - 5 + text_height + 10 + self.tf),
# self.im, color,
# (position[0], position[1] - text_height - 5), -1,
# (position[0] + text_width + 10, position[1] - text_height - 5 + text_height + 10 + self.tf), )
# color, # Draw text
# -1, cv2.putText(self.im, display_text, position, 0, self.sf, txt_color, self.tf)
# )
# # Draw text return text_height
# cv2.putText(self.im, display_text, position, 0, self.sf, txt_color, self.tf)
#
# return text_height
def plot_angle_and_count_and_stage( def plot_angle_and_count_and_stage(
self, angle_text, count_text, stage_text, center_kpt, color=(104, 31, 17), txt_color=(255, 255, 255) self, angle_text, count_text, stage_text, center_kpt, color=(104, 31, 17), txt_color=(255, 255, 255)

Loading…
Cancel
Save