如何在 google colab 上访问实时网络摄像头?

问题描述 投票:0回答:1

我正在做一个项目,我需要从本地网络摄像头访问视频源。 在使用 google colab 时有什么方法可以访问我的本地网络摄像头吗?

我尝试了以下代码,但在 colab 上不起作用

import cv2

vid_feed = cv2.VideoCapture(0)

while True:
    check, frame = vid_feed.read()
    cv2.imshow('feed', frame)
    key = cv2.waitKey(1)
    if key == 'q':
        break

vid_feed.release()
cv2.destroyAllWindows()
python deep-learning google-colaboratory webcam cv2
1个回答
1
投票

(第一个对不起我的英语)您需要转到左侧面板并单击“<>”选项

enter image description here

完成后,在右侧面板中,您可以看到“相机捕获”选项,如果单击此按钮,将打开一个脚本,您必须执行该脚本才能使用网络摄像头。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.