博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python调用笔记本电脑摄像头
阅读量:3960 次
发布时间:2019-05-24

本文共 387 字,大约阅读时间需要 1 分钟。

import cv2import numpy as npdef video_demo():    capture = cv2.VideoCapture(0)  # 0为电脑内置摄像头    while (True):        ret, frame = capture.read()  # 摄像头读取,ret为是否成功打开摄像头,true,false。 frame为视频的每一帧图像        frame = cv2.flip(frame, 1)  # 摄像头是和人对立的,将图像左右调换回来正常显示。        cv2.imshow("video", frame)        c = cv2.waitKey(50)        if c == 27:            breakvideo_demo()cv2.destroyAllWindows()

转载地址:http://zwhzi.baihongyu.com/

你可能感兴趣的文章