我正在python中测试openCV,我制作了一个简单的网络摄像头,仅以黑白显示,但我想知道是否有可能以某种方式将其连接到不和谐状态,所以每当我打电话给 friend 时,他都会以黑白看到我。 `
import cv2
capture = cv2.VideoCapture(0)
capture.set(3, 640)
capture.set(4, 480)
capture.set(10, 300)
while True:
sucess, img = capture.read()
img = cv2.Canny(img, 100, 100)
cv2.imshow("Webcam", img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
最佳答案
这可能已经晚了,但请查看pyvirtualcam
首先安装:
pip install pyvirtualcam
您可以这样:import pyvirtualcam
import numpy as np
with pyvirtualcam.Camera(width=1280, height=720, fps=30) as cam:
while True:
frame = np.zeros((cam.height, cam.width, 4), np.uint8) # RGBA
frame[:,:,:3] = cam.frames_sent % 255 # grayscale animation
frame[:,:,3] = 255
cam.send(frame)
cam.sleep_until_next_frame()
cam.sleep_until_next_frame()
关于python - 如何使用python制作虚拟相机?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63475061/