bbdraw
Library for drawing labeled bounding boxes / bounding polygons
Example image showing labeled bounding boxes and bounding polygons
Basically, a small wrapper around the python pillow library that combines drawing boxes and writing labels into one simple function call:
corners = [(650, 290), (715, 335)] image = bbdraw.rectangle(image, corners, text="cactus", color="red")
Installation
Needs python >= 3.5
pip3 install bbdraw
Usage
from PIL import Image
import bbdraw
image = Image.open("example.jpg")
# box/rectangle is given by two corners
# either as list of tuples [(x0, y0), (x1, y1)] or flat list [x0, y0, x1, y1]
corners = [(650, 290), (715, 335)]
image = bbdraw.rectangle(image, corners, text="cactus", color="red")
# polygon is given by list of vertices
# either as list of tuples [(x0, y0), (x1, y1), (x2, y2), ...]
# or as flat list [x0, y0, x1, y1, x2, y2, ...]
vertices = [(440, 360), (400, 265), (525, 195), (590, 280), (520, 360)]
image = bbdraw.polygon(image, vertices, text="shrub", color="green")
# use in_place=True to directly draw on the input image, instead of making a copy
corners = [(1080, 350), (1180, 285)]
bbdraw.rectangle(image, corners, text="cactus", color="red", in_place=True)
image.save("example_out.jpg")
Metadata
Release files for bbdraw 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bbdraw-0.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bbdraw-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / bbdraw-0.1.tar.gz
| Download URL | bbdraw-0.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7226a732afc79026addaa0c9178f4a16528fbf982f237ade0133472ab5af7d9
|
|
BLAKE2b-256 checksum How to use checksums |
9739b2709c79fca58602f0ada917d9329edff35ca0878a9ca73036e6f75d6c28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Release files / bbdraw-0.1-py3-none-any.whl
| Download URL | bbdraw-0.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1627fec48d6b2cea8258c98036405c41c24d191c295f74bf28bb6ea25c2a9cc3
|
|
BLAKE2b-256 checksum How to use checksums |
508d31e5650acf2f07320e4c07b3f28cd0ff87dbce88ad5e04a39d5652c6cc2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|