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.
Latest Release | |
License |
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) with channels in BGR order (same as openCV format).left
: 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. If not specified, then no label is displayed.color
: A string representing the color of the bounding box. Possible values are:navy
,blue
,aqua
,teal
,olive
,green
,lime
,yellow
,orange
,red
,maroon
,fuchsia
,purple
,black
,gray
,silver
. Iflabel
is specified andcolor
is not, then a color depending on thelabel
is randomly chosen. If neithercolor
andlabel
is specified then the bounding box color is defaulted togreen
.
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.