Update documentation
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user