mtl
mtl
(moving time-lapse) is a python
tool to create time lapse animation from photos taken not from a fixed camera (hence 'moving') with identifiable markers.
mtl
align time series photos with markers (3 or 4 markers) provided as .TPS file (digitized with TPSDig software), and output the aligned photos and time-lapse movie.
requires
mtl
is based on OpenCV's [1] implementation of affine transformation (with 3 markers provided) and perspective transformation (with 4 markers provided) [2].
Output of time-lapse video is based on ffmpeg [3]. To use mtl
, both OpenCV
and ffmpeg
are required.
how to use?
- Use as a
python
package.mtl
is on PyPI and can be installed withpip
(in command line, i.e.cmd
in Windows [4] /terminal
in Unix systems):
pip install mtl
- Directly use the
mtl.py
python
module, if you prefer. Download the file.
mtl
can be directly used as command line script, with the following arguments:
-h, --help show this help message and exit -t, --tps path to tps file containing landmarks for alignments -i, --img path to the directory containing images to be aligned -s, --sep separator between individual and time in image name. NOTE: use single quote (') for special character in Unix systems
Alternatively, mtl
can be imported into python
(in python
):
from mtl import align
The main function of mtl
is align
, which provides more options. For further details run (in python
):
help(align)
preparing images and markers file
mtl
supports batch processing of multiple time series photos. Different time series (such as 'individuals') and time points should be indicated in the file name of the images. For examples, 1-1.tif
, 1-2.tif
, ..., 1-100.tif
and a-1.tif
, a-2.tif
, ..., a-100.tif
will be processed as two different time series of '1' and 'a' with time points of 1, 2, ..., 100. These images should be placed in a single directory. A dash '-' is used to separate the time series and time points here so this should be instructed to the program. Only a single .TPS
file is required for processing multiple time series photos, and it should contains markers for all images in the directory to be processed.
notes
[1] | OpenCV's installation guide for Windows; Installation guide for Debian systems. |
[2] | A nice explanation on the transformation methods can be found here. |
[3] |
FFmpeg's installation guide for Windows; In Ubuntu it can be installed with apt (apt-get install ffmpeg ) |
[4] | Use pip in Windows |