Skip to main content

Package to simplify bounding boxes usage

Project description

bounding_box

A Python package designed to simplify bounding box operations for object detection. It provides functions to calculate box centers, dimensions, and intersections, reducing the complexity of these tasks in your code. With Bounding_Box, you can streamline your object detection workflow, making it more efficient and straightforward.

Installation

pip install easy-bounding-box

Example

from easy_bounding_box import BoundingBox
import numpy as np
import cv2

img = np.zeros((750,1000,3))

bounding_box = BoundingBox([547.31, 41.473, 940.4, 712.92])
bounding_box_2 = BoundingBox((500, 20, 700, 350))

bounding_box_3 = bounding_box_2.change_size(0.4, False)

line = (100, 250, 530, 250)

img = cv2.line(img, line[:2], line[2:], (255,255,0), 2)

img = cv2.rectangle(img, bounding_box[:2], bounding_box[2:], (255,0,0), 2)

img = cv2.rectangle(img, bounding_box_2[:2], bounding_box_2[2:], (0,255,0), 2)

img = cv2.rectangle(img, bounding_box_3[:2], bounding_box_3[2:], (0,0,255), 2)

print("Bounding box 2 is intercepting blue line: ", bounding_box_2.box_intercept_line(line))
print("bounding box is intercepting bounding_box_2: ", bounding_box.box_intercept_box(bounding_box_2.bounding_box))
print("How much of bounding_box_2 is in bounding_box: ", bounding_box_2.iou(bounding_box.bounding_box))
print("Bounding box 3 values: ", bounding_box_3.bounding_box)
print("Bounding box 3 listed values: ", bounding_box_3.list_bounding_box)
print("Bounding box 3 middle: ", bounding_box_3.middle)
print("Bounding box 3 listed middle: ", bounding_box_3.list_middle)
print("Bounding box 3 dimensions: ", bounding_box_3.dimensions)
print("Bounding box 3 listed dimensions: ", bounding_box_3.list_dimensions)
print("Bounding box 3 area: ", bounding_box_3.area)
print("Bounding box 3 walls coordinates: ", bounding_box_3.walls)

cv2.imshow("image", img)
  
cv2.waitKey(0)

cv2.destroyAllWindows()

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

easy_bounding_box-0.0.5.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

easy_bounding_box-0.0.5-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file easy_bounding_box-0.0.5.tar.gz.

File metadata

  • Download URL: easy_bounding_box-0.0.5.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for easy_bounding_box-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e6b29c209d72503b3144eb96c319b31b465ecf472e1d6e30e5ff3a2f3960f9dd
MD5 0800665d5bd026a48ac2be43cce48f18
BLAKE2b-256 0318ecce0c8387d411f90ae852910be89d691a6724549d88bef11dd75d8a96ac

See more details on using hashes here.

File details

Details for the file easy_bounding_box-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_bounding_box-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ce39a2113d811417728e04b8265d0893f87ee08b886d065cea14b09104d71968
MD5 d96c7ef684c1c445209d0f0f898b1c40
BLAKE2b-256 c0aeeaf75831008c342242344868ddd41c75ba71a3dca72c79678ad2580fe832

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