Update documentation

This commit is contained in:
2023-12-28 16:12:31 +01:00
parent a6ed18303e
commit 2a29b414b1
12 changed files with 8674 additions and 3668 deletions
+8
View File
@@ -1,4 +1,12 @@
def convert_to_yolo(bbox, width, height):
"""Transform bounding boxes in xmin, ymin, xmax, ymax format to
YOLO format.
:param bbox: bounding box in xmin, ymin, xmax, ymax format
:param width: width of the image
:param height: height of the image
:returns List[int]: bounding box in YOLO format
"""
modified = bbox.copy()
modified['xmin%'] = round(bbox['xmin'] / width * 100, 2)
modified['ymin%'] = round(bbox['ymin'] / height * 100, 2)
+8
View File
@@ -2,6 +2,14 @@ import cv2
def draw_boxes(image, bboxes):
"""Draw bounding boxes in xmin, ymin, xmax, ymax format onto
image.
:param image: opencv2 image object in BGR
:param List bboxes: bounding boxes in xmin, ymin, xmax, ymax
format
:returns: img with bounding boxes drawn
"""
img = image.copy()
for idx, bbox in enumerate(bboxes):
xmin, ymin, xmax, ymax = bbox