這篇文檔,完全借鑒miguelgrinberg的博客。
https://blog.miguelgrinberg.com/post/flask-video-streaming-revisited
想看具體實現細節,可以看上面文章。
目的:要用攝像頭獲取圖像,后期做人臉識別。
可以直接獲取他的代碼:
git clone https://github.com/miguelgrinberg/flask-video-streaming.git
然后運行代碼如下:
$ CAMERA=opencv python app.py
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
效果如下: