Bounding Box is a library to plot pretty bounding boxes with a simple Python API.
BSD-3-CLAUSE License
Bounding Box is a library to plot pretty bounding boxes with a simple Python API.
Please notice this lib does not do object detection for you, but only helps to display pretty bounding boxes with a carefully chosen set of colors.
WARNING: Version 1.0 of this library is not yet released. API breaking changes could still occur!
Please see below some examples of bounding boxes plotted with this library.
$ pip install bounding-box [--user]
First, you have to import bounding_box
:
from bounding_box import bounding_box as bb
Then, just add the bounding box on an image.
bb.add(image, left, top, right, bottom, label, color)
This method takes 5 mandatory parameters:
image
: A numpy array, channel last (ie. height x width x colors) withleft
: A integer representing the left side of the bounding box.top
: A integer representing the top side of the bounding box.right
: A integer representing the right side of the bounding box.bottom
: A integer representing the bottom side of the bounding box.This method takes also 2 optional parameters:
label
: A string representing the label of the bounding box.color
: A string representing the color of the bounding box.navy
, blue
, aqua
, teal
, olive
, green
,lime
, yellow
, orange
, red
, maroon
, fuchsia
, purple
,black
, gray
,silver
.label
is specified and color
is not, then a color dependinglabel
is randomly chosen.color
and label
is specified then the bounding boxgreen
.The script to plot exemples of this README is available here.
To run it, go in top level of this git repository then write:
python docs/examples.py
If you run examples.py
in an other directory it won't work.