In [1]:
import cv2
In [2]:
cap=cv2.VideoCapture(0)
In [3]:
frame=cap.read()
frame
Out[3]:
(True, array([[[ 30,  31,  27],
         [ 30,  31,  27],
         [ 28,  30,  30],
         ...,
         [165, 165, 165],
         [165, 165, 165],
         [165, 165, 165]],
 
        [[ 26,  30,  29],
         [ 26,  30,  29],
         [ 28,  30,  30],
         ...,
         [165, 165, 165],
         [165, 165, 165],
         [165, 165, 165]],
 
        [[ 30,  33,  24],
         [ 30,  33,  24],
         [ 30,  30,  30],
         ...,
         [165, 165, 165],
         [157, 166, 164],
         [157, 166, 164]],
 
        ...,
 
        [[ 80,  80,  81],
         [ 80,  80,  81],
         [ 81,  81,  81],
         ...,
         [125, 137, 141],
         [116, 130, 128],
         [114, 128, 126]],
 
        [[ 81,  81,  82],
         [ 81,  81,  82],
         [ 82,  82,  82],
         ...,
         [ 91, 103, 107],
         [ 91, 105, 103],
         [102, 116, 114]],
 
        [[ 83,  81,  82],
         [ 84,  82,  83],
         [ 84,  83,  79],
         ...,
         [ 97, 100, 110],
         [ 83, 106, 103],
         [ 82, 105, 102]]], dtype=uint8))
In [7]:
while(True):
    ret,frame=cap.read()
    cv2.imshow('frame',frame)
    if(27==cv2.waitKey(25)):
        break
# cap.release()
cv2.destroyAllWindows()
In [ ]: