Hi !
I always write this from scratch, so it seems that I’ll drop this one here. So next time I search for this, I’ll find myself.
And with some extra lines, we can even detect faces and display some face landmarks:

This is the base of some many image recognition scenarios, so I hope this will save me some local search time π
Happy coding!
Greetings @ Toronto
El Bruno
References
My posts on Face Recognition using Python
- Detecting Faces with 20 lines in Python
- Face Recognition with 20 lines in Python
- Detecting Facial Features with 20 lines in Python
- Facial Features and Face Recognition with 20 lines in Python
- Performance improvements with code
- More performance improvements, lowering the camera resolution
And some general Python posts
- Anaconda distribution https://www.anaconda.com/distribution/
- El Bruno, Canβt install TensorFlow on Anaconda, maybe is the Visual Studio distribution https://elbruno.com/2019/09/09/python-cant-install-tensorflow-on-anaconda-maybe-is-the-visual-studio-distribution/
- El Bruno, Anaconda, How to create a custom #Python virtual environment and use it in Jupyter notebooks (a kernel!) https://elbruno.com/2019/09/10/anaconda-how-to-create-a-custom-python-virtual-environment-and-use-it-in-jupyter-notebooks-a-kernel/
- My steps to install a virtual environment with TensorFlow, Keras and more https://elbruno.com/2019/09/12/anaconda-my-steps-to-install-a-virtual-environment-with-tensorflow-keras-and-more/
- Letβs use a Face Recognition demo app for a performance comparison between RaspberryPi3 and RaspberryPi4 https://elbruno.com/2019/08/19/python-lets-use-a-facerecognition-demo-app-for-a-performance-comparison-between-raspberrypi3-and-raspberrypi4/
- Detecting Hololens in realtime in webcam feed using ImageAI and OpenCV with performance improvements https://elbruno.com/2019/08/12/python-detecting-hololens-in-realtime-in-webcam-feed-using-imageai-and-opencv-with-performance-improvements/
3 comments