0x01 OpenCV安装
通过命令pip install opencv-python安装
pip install opencv-python
0x02 示例
import cv2
cap = cv2.VideoCapture(0) #打开摄像头
while(1):
# get a frame
ret, frame = cap.read()
# show a frame
cv2.imshow("capture", frame) #生成摄像头窗口
if cv2.waitKey(1) & 0xFF == ord('q'): #如果按下q 就截图保存并退出
cv2.imwrite("D:/test.png", frame) #保存路径
break
cap.release()
cv2.destroyAllWindows()
ps:下面看下python 调用麦克风;摄像头;截屏;
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 14:47:35 2019
@author: erio
"""
from PIL import Image,ImageGrab
import cv2
import pyaudio
import wave
'''
#录音
input_filename = "record.wav" # 麦克风采集的语音输入
input_