cv2 transparent rectangle
#cv2 transparent rectnagle
#answerd by LUBAN MAHFUZ
import cv2
import numpy as np
cap = cv2.VideoCapture(1)
while True:
success, img = cap.read()
#transparent rectangle start here_____________
bbox = [300,100,200,200]
blk = np.zeros(img.shape, np.uint8)
cv2.rectangle(blk, (300,100),(500,300),(225,225,225),cv2.FILLED)
img = cv2.addWeighted(img, 1.0, blk, 0.50, 1)
#transparent rectangle stop here______________
cv2.imshow("Image", img)
cv2.waitKey(1)
if cv2.waitKey(100) == ord('q'):
break
cv2.destroyAllWindows()