Skip to content

Instantly share code, notes, and snippets.

View Ashwinning's full-sized avatar

Ashwin Sinha Ashwinning

View GitHub Profile
@Ashwinning
Ashwinning / draw_text_with_background_opencv.py
Last active May 30, 2019 19:46 — forked from aplz/draw_text_with_background_opencv.py
draw text with background // opencv
import cv2
class DrawText:
def __init__(self, img, text, font_scale = 1, posX = 10, posY = 10, font = cv2.FONT_HERSHEY_PLAIN, bgColor = (255, 255, 255), textColor = (0, 0, 0), fontThickness = 1, padding = 2):
self.font_scale = font_scale
self.font = font
rectangle_bgr = bgColor
# set some text
self.text = text
# get the width and height of the text box
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev