Skip to content

🧔 Face morphing on multiple images using 68 landmarks and Delaunay triangulation.

Notifications You must be signed in to change notification settings

provostm/face-morphing-multiple-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

face-morphing-multiple-images

Credit to: https://github.com/Azmarie/Face-Morphing

This repo is an upgrade where we can morph multiple images into video.

Check out Azmarie's repo first to understand all the details.

Execution

  1. Place your images in a folder, for example raw_images
  2. Use the command python code/utils/align_images.py raw_images/ aligned_images/ --output_size=1024 to select images from "raw_images" with a face and align/rotate them and put them in "aligned_images".
  3. Launch the command to create the video :

python code/__init__.py --folder aligned_images --output video_output.mp4 --duration 4

Note that this will create temporary videos (--tmpfolder) and then combine them into one video (--output).

Results :

ezgif-3-0130e3d9d289

Details to call code/init.py

  • --img1 : The First Image (not necessary when --folder is used)
  • --img2 : The Second Image (not necessary when --folder is used)
  • --folder : The folder with all images to morph (not necessary when --img1 and --img2 are used)
  • --duration : The duration of morphing from one image to the other.
  • --frame : The frame rate of the encoding.
  • --output : Final video path.
  • --tmpfolder : Folder to store intermediate videos.

How it works on multiple videos?

  1. The program goes through all the images in --folder with a for loop
  2. For each 2 images we apply what was done by Azmarie's original repo and this outputs a video. We store them in --tmpfolder
  3. We append to a text file named imageslist.txt the names of the videos like so : file '<filename_of_the_video>'
  4. After dealing with all images we can encode one big video using imageslist.txt and the right ffmpeg command:

ffmpeg -f concat -safe 0 -i imageslist.txt -c copy output.mp4

Note: This is not the most optimized way to do it but it works. It would be better to directly encode one video but it would be a lot of work on Azmarie's work to do.

About

🧔 Face morphing on multiple images using 68 landmarks and Delaunay triangulation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages