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
Built Distribution
Close
Hashes for easy_bounding_box-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce39a2113d811417728e04b8265d0893f87ee08b886d065cea14b09104d71968 |
|
MD5 | d96c7ef684c1c445209d0f0f898b1c40 |
|
BLAKE2b-256 | c0aeeaf75831008c342242344868ddd41c75ba71a3dca72c79678ad2580fe832 |