Mac“中止” OpenCV Python脚本
发布于 2021-01-29 18:01:21
所以我只是试图运行基本的OpenCV程序
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()
但是由于某种原因,当我尝试运行它(使用python 2或3)时,我得到了这个奇怪的中止语句
[1] 74309 abort python3 index.py
(我猜5位数是PID),但是,如果我在VideoCapture函数中传递到已经存在的视频的路径,它确实可以工作。我是所有这方面的初学者,所以我不确定是什么问题
谢谢 :)
关注者
0
被浏览
39