考虑:
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_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()我在OpenCV IDE中使用Python和PyCharm。当我尝试使用OpenCV打开网络摄像头时,会出现以下错误:
程序已完成,出口代码134 (被信号6: SIGABRT中断)
这是因为我快没记忆了吗?解决这个问题的方法是什么?
我在MacBook Pro上使用MacBook (OS:macOS v10.14 (Mojave))。
发布于 2019-09-10 13:01:58
- Key: Privacy - Camera Usage
- Type: String
- Value: An application in PyCharm wants to use the camera.
发布于 2019-10-04 11:18:59
因为这个,我在问题开了JetBrains。但这里有一个解决办法:
从PyCharm或IntelliJ理念 (任何JetBrains应用程序)中运行已经批准用于相机访问的应用程序。例如,我使用超高压终端运行IDE,一切都正常。
发布于 2019-08-03 14:00:54
通过在Visual Studio代码中运行Python,它将在没有任何警告或bug的情况下执行程序。
https://stackoverflow.com/questions/57230407
复制相似问题