Add functions descriptions in plotting.py (#17813)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Muhammad Rizwan Munawar 2024-11-28 06:05:23 +05:00 committed by GitHub
parent 7e2ce71c29
commit 408d4380a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,7 +238,16 @@ class Annotator:
}
def get_txt_color(self, color=(128, 128, 128), txt_color=(255, 255, 255)):
"""Assign text color based on background color."""
"""
Assign text color based on background color.
Args:
color (tuple, optional): The background color of the rectangle for text (B, G, R).
txt_color (tuple, optional): The color of the text (R, G, B).
Returns:
txt_color (tuple): Text color for label
"""
if color in self.dark_colors:
return 104, 31, 17
elif color in self.light_colors:
@ -544,7 +553,9 @@ class Annotator:
bbox (tuple): Bounding box coordinates in the format (x_min, y_min, x_max, y_max).
Returns:
angle (degree): Degree value of angle between three points
width (float): Width of the bounding box.
height (float): Height of the bounding box.
area (float): Area enclosed by the bounding box.
"""
x_min, y_min, x_max, y_max = bbox
width = x_max - x_min