Skip to main content

A package to plot pretty bounding boxes for object detection task

Project description


A package to plot pretty bounding boxes for object detection task


pip install plotbbox

Example Usage

import cv2
from plotbbox import plotBBox

img = cv2.imread("your_img.png")

label_table = {0: "person", 1: "car"}
color_table = {0: [0, 255, 0], 1: [0, 0, 255]} # order: b, g, r

bboxes = your_detection_algorithm(img) # Shape: (N, 5), [:, 0]: class index, [:, 1:]: xmin, ymin, xmax, ymax

for bbox in bboxes:

  class_idx = bbox[0]
  xmin, ymin, xmax, ymax = bbox[1:]

           xmin, ymin, xmax, ymax, color=color_table[class_idx], thickness=1, 
           label=label_table[class_idx]) # plot bounding box on img

cv2.imwrite("bboxes_plotted_your_img.png", img)

Read docs/ and run for more details!

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

plotbbox-0.1.3.tar.gz (151.5 kB view hashes)

Uploaded source

Built Distribution

plotbbox-0.1.3-py3-none-any.whl (151.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page