Skip to content

Bounding Box is a library to plot pretty bounding boxes with a simple Python API.

License

Notifications You must be signed in to change notification settings

nalepae/bounding-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bounding Box

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 latest release
License 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.

Installation

$ pip install bounding-box [--user]

API

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. If label is specified and color is not, then a color depending on the label is randomly chosen. If neither color and label is specified then the bounding box color is defaulted to green.

Examples

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.