美文网首页
python opencv 使用摄像头捕获视频并显示

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

作者: 乃铭 | 来源:发表于2019-07-21 19:53 被阅读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()
    
    

    相关文章

      网友评论

          本文标题:python opencv 使用摄像头捕获视频并显示

          本文链接:https://www.haomeiwen.com/subject/uqpvlctx.html