【发布时间】:2021-07-24 08:45:29
【问题描述】:
我有一个小型 OpenCV 脚本,可与我的 Windows 笔记本电脑摄像头配合使用,但在插入外部 Logitech C922 Pro 高清流网络摄像头时无法正常工作。
我已更改 cap = cv2.VideoCapture(xxxNUMBERxxx) 中的数字以打开相机但没有运气。我也安装了罗技驱动程序,但没有运气。互联网的其他人似乎认为这是一个权限问题,但我找不到任何特定的权限设置,所以我不确定这是问题所在。我只是希望能够从摄像头获取视频流。
脚本如下:
import numpy as np
import cv2
cap = cv2.VideoCapture(2, cv2.CAP_DSHOW)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
【问题讨论】:
标签: python opencv camera logitech