gpt4 book ai didi

python - 如何使用 python 编辑相机帧?

转载 作者:行者123 更新时间:2023-12-05 08:05:35 25 4
gpt4 key购买 nike

我需要在直播(google.meet、Skype、FaceTime 等)期间编辑计算机网络摄像头的画面。

我尝试使用 OpenCV,但我不知道如何重定向输出以替换相机的原始帧或将输出渲染到相机路径。

import cv2

video = cv2.VideoCapture(0)
if not video.isOpened():
raise Exception('Video is not opened!')

while True:
ret, frame = video.read() # Capture frame-by-frame

# here edits like blur...
blurred_frame = cv2.blur(frame, (10, 10))
cv2.imshow('Video', blurred_frame) # Display the resulting frame

if cv2.waitKey(1) & 0xFF == ord('q'):
break

# release the capture
video.release()
cv2.destroyAllWindows()

有人可以帮我解决这个问题吗?

我在 macOS Catalina 上运行,使用 Python 3.7.4

最佳答案

只需在窗口中显示帧并使用开放式广播工作室 (obs) 应用程序捕获该窗口并使用 obs 的虚拟相机进行缩放

关于python - 如何使用 python 编辑相机帧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64176034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com