【发布时间】:2021-03-05 00:21:51
【问题描述】:
我的问题是当我尝试在我的 Mac 上运行此代码时,相机会亮起绿灯,但它根本没有打开。我不知道为什么会这样。我尝试了很多东西,但没有任何效果,我只是认为 Apple 的新更新搞砸了一些东西,因为它以前可以工作。
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
# Display the resulting frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
【问题讨论】:
-
我正在经历同样的事情,你找到解决方案了吗??
-
我建议您查看此链接。 stackoverflow.com/questions/64838511/…