Skip to content

Instantly share code, notes, and snippets.

View rinaldo-rex's full-sized avatar
🤔
In progress...

Rinaldo Rex rinaldo-rex

🤔
In progress...
View GitHub Profile
@rinaldo-rex
rinaldo-rex / Transparent drawings in OpenCV.py
Created April 5, 2020 14:10 — forked from IAmSuyogJadhav/Transparent drawings in OpenCV.py
Add transparency to rectangles, circles, polgons, text or any shape drawn in OpenCV.
import cv2
image = cv2.imread('test.jpg')
overlay = image.copy()
x, y, w, h = 10, 10, 10, 10 # Rectangle parameters
cv2.rectangle(overlay, (x, y), (x+w, y+h), (0, 200, 0), -1) # A filled rectangle
alpha = 0.4 # Transparency factor.