[PYTHON] Outline the face using Dlib (1)

SS 192.png 顔の輪郭とか口の動き抽出するやつを今すぐパッと試したい。

things to do

Use Dlib and Python to perform face tracking for facial contours and mouth movements. It is immediately reflected and displayed on what was acquired by the WEB camera of the PC (Mac in this case). This article is a reminder to trace the Qiita article published in 2017 now.

I will refer to the answers in the past Qiita articles

Qiita article: Display the result of face landmark recognition of dlib with matplotlib in real time

Basically, I'm grateful to follow the above, but there are some changes.

changes

Since the reference URL of the data file has been changed, download it separately and execute it.

https://www.kkaneko.jp/dblab/dlib/dlibface.html Refer to here,

http://dlib.net/files/ Open this and download and expand "shape_predictor_68_face_landmarks.dat.bz2".

In the program mentioned above

python


predictor_path = "hoge" 

It is safe to specify the above file with the absolute path in the place of hoge.

Execution result

soseki.gif

I'm showing the bill to the camera of my PC. Of course, you can get a live-action face properly.

next time

I would like to try if there is a method that can be recognized and displayed a little faster and that is absurd. I also want to judge facial expressions.

Recommended Posts

Outline the face using Dlib (1)
Tokenize using the Hugging Face library
Try using the Twitter API
Clone using the dd command
I tried face recognition of the laughter problem using Keras.
Face detection with Python + dlib
Try using the Twitter API
Try using the PeeringDB 2.0 API
[Ubuntu] [Python] Object tracking using dlib
Check the return value using PEP 380
Make a face recognizer using TensorFlow
Face recognition using principal component analysis
Precautions when using the urllib.parse.quote function
Extract the targz file using python
Try using the Python Cmd module
Let's cut the face from the image
Let's display the map using Basemap
Face detection using a cascade classifier
Notes on using matplotlib on the server
Get the file path using Pathlib
I tried using the checkio API
I tried to transform the face image using sparse_image_warp of TensorFlow Addons
Get and estimate the shape of the head using Dlib and OpenCV with python