This project is based on this YouTube video, but instead of using the dlib package, I used mediapipe for the face detection process.
-
first you need to install opencv and mediapipe
pip install opencv-python
pip install mediapipe
-
then run realtime_face_swapping.py
python realtime_face_swapping.py
- first with opencv we read the first face image.
- then by using mediapipe we can find the landmarks on the first face image.
- using opencv and the specified landmarks, we can create some triangles on the first face image.
- we do the same to the second image that we read from camera by using opencv.
- after that we map the corresponding triangles from first face image to the second face image.