Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
shoumikchow committed Sep 25, 2020
1 parent 0c7a11a commit ab48fbe
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 87 deletions.
15 changes: 9 additions & 6 deletions README.md
@@ -1,13 +1,16 @@
# Bbox_Visualizer
# bbox-visualizer

This is a simple library which has different functions that lets users draw different types of visualizations. Useful for instances when visualizing objects after object detection.
This is a simple library which has different functions that lets users draw different types of visualizations. Useful for visualizing objects after object detection.

The bounding box points are expected in the format: `(xmin, ymin, xmax, ymax)`

* Documentation: https://bbox-visualizer.readthedocs.io.
* Free software: MIT license


## Installation:
pip install bbox-visualizer

## Usage:

import bbox_visualizer as bbv
Expand All @@ -23,11 +26,11 @@ The bounding box points are expected in the format: `(xmin, ymin, xmax, ymax)`

| **image** | **function** |
|:----------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------:|
| ![bbox with label on top](images/bbox_top.jpg "Bouding box with label on top") | bbv.draw_rectangle(img, bbox)<br>add_label(img, label, bbox, top=True) |
| ![bbox with label inside](images/bbox_inside.jpg "Bouding box with label inside") | bbv.draw_rectangle(img, bbox)<br>add_label(img, label, bbox, top=False) |
| ![bbox with T label](images/bbox_T.jpg "Bouding box with label inside") | bbv.draw_rectangle(img, bbox)<br>add_T_label(img, label, bbox) |
| ![bbox with label on top](images/bbox_top.jpg "Bouding box with label on top") | bbv.draw_rectangle(img, bbox)<br>bbv.add_label(img, label, bbox, top=True) |
| ![bbox with T label](images/bbox_T.jpg "Bouding box with label inside") | bbv.draw_rectangle(img, bbox)<br>bbv.add_T_label(img, label, bbox) |
| ![label with flag](images/flag.jpg "Label that looks like a flag, pole originates from inside the object") | bbv.draw_flag_with_label(img, label, bbox) |
| ![label with opaque overlay](images/overlay.jpg "Opaque bounding box with label inside the box") | bbv.draw_rectangle(image, bbox, is_opaque=True)<br>add_label(img, label, bbox, draw_bg=False, top=False) |
| ![bbox with label inside](images/bbox_inside.jpg "Bouding box with label inside") | bbv.draw_rectangle(img, bbox)<br>bbv.add_label(img, label, bbox, top=False) |
| ![label with opaque overlay](images/overlay.jpg "Opaque bounding box with label inside the box") | bbv.draw_rectangle(image, bbox, is_opaque=True)<br>bbv.add_label(img, label, bbox, draw_bg=False, top=False) |
| ![multiple bbox](images/bbox_multiple.jpg "Multiple bounding boxes") | bbv.draw_multiple_rectangles(img, bboxes)<br>bbv.add_multiple_labels(img, labels, bboxes) |
| ![multiple flags](images/bbox_multiple_flags.jpg "Multiple flags") | bbv.draw_multiple_flags_with_labels(img, labels, bboxes) |
| ![multiple T bbox](images/bbox_multiple_T.jpg "Multiple bounding boxes with T labels") | bbv.draw_multiple_rectangles(img, bboxes)<br>bbv.add_multiple_T_labels(img, labels, bboxes) |
Expand Down
9 changes: 5 additions & 4 deletions bbox_visualizer/__init__.py
Expand Up @@ -5,11 +5,12 @@
__version__ = '0.1.0'

from .bbox_visualizer import (
draw_rectangle,
add_label,
add_multiple_labels,
add_multiple_T_labels,
add_T_label,
draw_rectangle,
draw_flag_with_label,
add_multiple_labels,
add_multiple_T_labels,
draw_multiple_rectangles,
draw_multiple_flags_with_labels)
draw_multiple_flags_with_labels
)
2 changes: 1 addition & 1 deletion bbox_visualizer/bbox_visualizer.py
Expand Up @@ -354,5 +354,5 @@ def draw_multiple_flags_with_labels(img,

for label, bbox in zip(labels, bboxes):
img = draw_flag_with_label(img, label, bbox, write_label, line_color,
text_bg_color, text_color)
text_bg_color, text_color)
return img
109 changes: 33 additions & 76 deletions images/cover_source.json

Large diffs are not rendered by default.

0 comments on commit ab48fbe

Please sign in to comment.