Skip to main content

Simple bounding box operations

Project description

Package bbx

Simple operations over bounding boxes. The package provides a class Boxes encapsulating a set of bounding boxes. Internally, the boxes are represented in an Nx4 matrix with x1,y1,x2,y2 coordinates. Instances of Boxes support arbitraty user-defined fields which can hold other properties of boxes like e.g. score.

import bbx

B = bbx.Boxes([0,0,10,10])  # New instance
B.set_field("score", [1])  # Set the field
B.width()  # [10]
C = bbx.resize(B, 2)  # Resize and make new instance
C.get() # [[-5,-5,15,15]]
C.get_field("score")  # [1]
C.area()  # [400]

But why?

... for the glory of s... But seriously, I use bounding boxes in every other project and there is no decent small package for this. Yes I can use TF obj detection api (and I did for a while, this pkg have similar interface to it) or structures from imgaug or others. I did not find anything that suits my needs (if you know about something just let me know). You either install a big non-standard package with tons of functionality you do not need or you implement it by yourself. So I decided to make a very small package that does precisely what I need and nothing more, is portable (just numpy needed, and you already have it!).

Yes, I just implemented a non-standard package, so I so not need to use other non-standard packages... yes, I know...

Installation

The package is in PyPI so just use pip

pip install bbx

Contribute

Feelin' brave? Contribute with code! You can also submit an issue if something is broken.

License

This code is published under MIT License

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

bbx-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bbx-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file bbx-1.0.0.tar.gz.

File metadata

  • Download URL: bbx-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.13

File hashes

Hashes for bbx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7658c1c83a31b932fba29d876950e870409a21f6000b9d22f485c078295eab90
MD5 468d51994c6f9ecff7bc2f8f007c4e2a
BLAKE2b-256 bcc751567e9722a38ae6e45f93aa2299089bbb59322ec0680af5d0033f8e7ac5

See more details on using hashes here.

File details

Details for the file bbx-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bbx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.13

File hashes

Hashes for bbx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f08b99c161dc97c3823dc992ccb89d4a4c43b3caac5b04f3ac58c947dc9a4c51
MD5 2dccb992ddbc09008f5ea198df909c7f
BLAKE2b-256 470702886ac6262d31f2ea2c40533baea421774c072047959ddad5c571702448

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page