OpenCV wont' capture from MacBook Pro iSight

后端 未结 2 1696
执笔经年
执笔经年 2020-12-18 05:08

Since a couple of days I can\'t open my iSight camera from inside an opencv application any more. cap = cv2.VideoCapture(0) returns, and cap.isOpened()

2条回答
  •  独厮守ぢ
    2020-12-18 05:27

    This is how I got the camera working for your code (on OSX 10.6):

    import cv2
    
    cv2.namedWindow("preview")
    vc = cv2.VideoCapture(0)
    
    rval, frame = vc.read()
    
    while True:
    
      if frame is not None:   
         cv2.imshow("preview", frame)
      rval, frame = vc.read()
    
      if cv2.waitKey(1) & 0xFF == ord('q'):
         break
    

提交回复
热议问题