Functions for bounding box processing
Project description
SimpleBBox
Functions for bounding box processing.
In many computer vision tasks a concept of a bounding box is used. In python bounding boxes are often represented as lists, tuples or numpy arrays of 4 elements. However there is no standard representation and different formats are used. Some formats are listed below.
(min x, min y, width, height) or (left, top, width, height)
(min x, min y, max x, max y) or (left, top, bottom, right)
(center x, center y, width, height)
The coordinates can represent either
relative position in the image dimensions. Then x takes values from 0..1 for pixels inside the image
or absolute position in pixel
This package contains utility functions to convert between those formats.
Installation
pip install simplebbox
Usage
from simplebbox.array import x0y0wh_to_x0y0x1y1, x0y0x1y1_to_x0y0wh
# convert bbox represented as list in ltwh format:
x0y0wh_to_x0y0x1y1([100, 200, 10, 20]) # [100, 200, 110, 220]
# and convert it back:
x0y0x1y1_to_x0y0wh([100, 200, 110, 220]) # [100, 200, 10, 20]
Notes
Free software: MIT license
Documentation: https://simplebbox.readthedocs.io.
History
0.0.1 (2020-12-16)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for simplebbox-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c90cccee293a1e7a42ca5ff26faa863253160493ac04c9d5efca42737ae3cd14 |
|
MD5 | 29095685e3a50b9db51af5fdd73d82ab |
|
BLAKE2b-256 | 143731030e40696b464141861f40d130004c73a8e8b3e169b1003e3ccc18c19b |