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()
I'm using Python and OpenCV in Pycharm IDE. When I try to open the webcam using OpenCV, it gives the following error:
" Process finished with exit code 134 (interrupted by signal 6: SIGABRT) "
Is this happening because I'm running out of memory? What are the solutions for this?
I'm using PyCharm on MacBook Pro (OS: Mojave)
Thanks!
Insert a new line:
Save it.
通过在 vs code(visual studio code)中运行 python 脚本将执行程序而没有任何警告或错误。
Open /Applications/PyCharm.app/Contents/info.plist in any text editor. Add these two line before dict & plist tag:
<key>Privacy - Camera Usage</key>
<string>An application in PyCharm wants to use the camera.</string>
</dict>
</plist>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.