Skip to main content

Clean draw of rectangle and polygon contours

Project description


If you are tired to always search how to overlay box/polygons into the images and have to trial-and-error to get the right Font size, thickness or lines and what not. Then this is for people like us.

Drawline overlays polygon contours and rectangle on images with minimum effort. It auto handles color picking for labels, font size, line thickness. (User has option to override it too)


pip install drawline

How to use

from drawline import draw_poly, draw_rect
import cv2

img_pth = '/PATH/TO/IMAGE.jpg'
image = cv2.imread(img_pth)

# for rectangles
result_image = draw_rect(image, (XMIN, YMIN), (XMAX, YMAX), label='labelname')

# for polygons
result_image = draw_poly(image, CONTOURS, label='labelname', show_rect=True) 

Default options

draw_poly(image, contour, fill_in=True, transparency=0.4, rgb=None, thickness=None, show_rect=True, label=None, label_rgb=(255, 255, 255), label_bg_rgb=None, label_font_size=None, random_color=True)

draw_rect(image, start_point, end_point, rgb=None, thickness=None, label=None, label_rgb=(255, 255, 255), label_bg_rgb=None, label_font_size=None, random_color=True)

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

drawline-0.0.2.tar.gz (4.4 kB view hashes)

Uploaded source

Built Distribution

drawline-0.0.2-py3-none-any.whl (5.5 kB view hashes)

Uploaded py3

Supported by

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