import cv2 as cv
def video_demo():
capture = cv.VideoCapture(0)
while(True):
ret,frame = capture.read()
frame = cv.flip(frame,1)
cv.imshow = ("video",frame)
c = cv.waitKey(50)
if c == 27:
break
video_demo()
#释放窗口
cv.destroyAllWindows()