关于Mac无法在pycharm调用摄像头的一点小记

对于代码

import cv2 as cv
import numpy as np
cap = cv.VideoCapture(0)
while(1):
    
    ret, frame = cap.read()
    
    hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV)
    
    lower_blue = np.array([110,50,50])
    upper_blue = np.array([130,255,255])
    
    mask = cv.inRange(hsv, lower_blue, upper_blue)
    
    res = cv.bitwise_and(frame,frame, mask= mask)
    cv.imshow('frame',frame)
    cv.imshow('mask',mask)
    cv.imshow('res',res)
    k = cv.waitKey(5) & 0xFF
    if k == 27:
        break
cv.destroyAllWindows()

MacOSX 10.14以上的系统无法在pycharm中调用摄像头
报错:

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

但可以在IDLE中调用摄像头

你可能感兴趣的:(常)