OK, so I’ve added another set of commands -morph_files
and -morph_video
which basically works like fade_files
and fade_videos
, with some extra parameters for the morphing algorithm.
The morphing is done between two consecutive frames by estimating both the forward and backward motion vectors (using an optical-flow like method), then interpolate the frames temporally using these two motion vector fields.
No need to say this can be very time consuming ! (even if like me you have 24 cores!)
How to use it?
-
First, update your filters, and check the commands are recognized:
gmic -update gmic -h morph_files
...(help should display here)...
An example of use, using image files as the input (here again, using bash on Linux, may be slightly different on Windows):
$ gmic -w -morph_files input_images\*.jpg,20,0.1,4,0,-1,1,output.png
(you may want to replace output.png
by output.avi
to gets an .avi
video file as the output).
And that’s almost the same if you have an input video file, instead of a sequence of images:
$ gmic -w --morph_video input_video.avi,20,0.1,4,0,-1,1,output.png
The smoothness
parameter is important to set correctly for the morphing algorithm. Basically if the frames you want to interpolate can be well registered by a rigid motion (translation,shift,…) then the smoothness
can be high (like 1 or 1.5). For non-rigid motions, try a lower value (0.1 is medium, 0.01 is low).