Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created May 6, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/8ada2bceaefdd30ac4fca3132f26f11c to your computer and use it in GitHub Desktop.
Save elbruno/8ada2bceaefdd30ac4fca3132f26f11c to your computer and use it in GitHub Desktop.
CameraOverlayLogo.py
# Bruno Capuano 2020
# display the camera feed using OpenCV
# add a bottom image overlay, using a background image
import time
import cv2
dsize = (640, 480)
# load bottom img
background = cv2.imread('Bottom03.png')
background = cv2.resize(background, dsize)
video_capture = cv2.VideoCapture(0)
time.sleep(2.0)
while True:
ret, frameOrig = video_capture.read()
frame = cv2.resize(frameOrig, dsize)
img = cv2.addWeighted(background, 1, frame, 1, 0)
cv2.imshow('Video', img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video_capture.release()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment