This repository uses optimal transport to compute the transformation between a picture and another. It is based on this code through the usage of POT. However, this repository contains the full code to generate such a video.
In order to use to it, you should change the configuration to your liking by
modifying conf.py
. It includes parameters for the transportation as well as
the computation itself (SLURM parameters if you're using such a job scheduler).
If SLURM is available, you can launch the computation by executing the following
in the src/
folder.
python3 launcher.py
This script will create a submission file for SLURM.
You can just launch the multiple scripts in the following order (inside the src/
folder):
python3 transport.py
python3 make_pics.py
python3 merge_pics.py
A notebook is also available, although it does not contain every feature of the script version (such as easing functions or the ability to handle more than 2 pictures to create a cycle). As such, the script version is recommended. The notebook can be very handy to try several parameters to get high quality pictures, such as points size or the contrast level.
After the computation, it is strongly advised to compress it, for instance with gifsicle. Such software is not available on Jean Zay, that is why it was not included in the code. You could for instance run the following:
gifsicle -O3 --colors 16 --lossy=200 mygif.gif > optimized.gif
In order to have a reasonable file size, you probably should also limit to 30 fps.
Here are a few examples computed with 40k points.