Some filters in opencv integrated with video streaming

--

import numpy as np
import cv2

cap = cv2.VideoCapture(1)
cap1= cv2.VideoCapture(0)

while(True):
ret, frame = cap.read()
ret1, frame1=cap1.read()
scale_percent = 30 # percent of original size
width = int(frame1.shape[1] * scale_percent / 100)
height = int(frame1.shape[0] * scale_percent / 100)
dim = (width, height)
resized=cv2.resize(frame1, dim,interpolation = cv2.INTER_AREA)
frame[0:144,0:192]=resized
#framenew=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV_FULL)
framenew=cv2.cvtColor(frame,cv2.COLOR_BGR2RGBA)
cv2.imshow("frme2",framenew)
offkey=cv2.waitKey(10)
if offkey == 13:
break

cap.release()
cv2.destroyAllWindows()

You can change the camera sources where there is 1 and 0 you can put something else, and i have put in two filters here, one is commented.
The blue area is for external camera and you can, similar to streamers stream something with your face in the top left

--

--

Drishan T Gupta
Drishan T Gupta

No responses yet