python opencv 使用摄像头捕获视频并显示

2019-07-21  本文已影响0人  乃铭
pip install pyinstaller -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
sudo apt-get install python-h5py
pip install Keras
pip install Theano
pip install Numpy
pip install Scipy
#pip install opencv-python
pip install --user cython
pip install scikit-image
pip install pillow
pip install tensorflow
#pip install hyperlpr
import cv2
cap = cv2.VideoCapture(0 + cv2.CAP_DSHOW)

while(1):
    # get a frame
    ret, frame = cap.read()
    # show a frame
    cv2.imshow("capture", frame)
    if cv2.waitKey(2000) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

from hyperlpr import *
import cv2
cap = cv2.VideoCapture(0 + cv2.CAP_DSHOW)

while(1):
    # get a frame
    ret, frame = cap.read()
    #读入图片
    #image = cv2.imread("frame")
    image = cv2.imread("C:/Users/guor/Pictures/demo.jpg")
    #识别结果
    print(HyperLPR_PlateRecogntion(image))
    if cv2.waitKey(800) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
from hyperlpr import  pipline as  pp
import cv2
image = cv2.imread("filename")
pp.RecognizePlateJson(image)
from hyperlpr import  pipline as  pp
import cv2
cap = cv2.VideoCapture(0 + cv2.CAP_DSHOW)

while(1):
    # get a frame
    ret, frame = cap.read()
    #识别结果
    print(pp.RecognizePlateJson(frame))
    if cv2.waitKey(800) & 0xFF == ord('q'):
        break

cap.release()

上一篇下一篇

猜你喜欢

热点阅读