1 opencv_trail_effect is an experiment about recreating the "trail effect"[1],
2 which can be seen in some cool music videos, automatically and in real-time,
3 and even without the use of a green-screen.
5 [1] http://dailypsychedelicvideo.com/tag/trail-effect/
7 Some examples of it are:
9 The Jacksons - Blame It On The Boogie - https://www.youtube.com/watch?v=mkBS4zUjJZo
10 OK Go - WTF? - https://www.youtube.com/watch?v=12zJw9varYE
11 Elisa - L'Anima Vola - https://www.youtube.com/watch?v=MqhxIQD16EA
13 opencv_trail_effect draws a trail after performing foreground segmentation
16 Segmentation in opencv_trail_effect can done using either thresholding or
17 background subtraction.
19 A few conditions are required to create a decent effect:
21 1. the camera should not move;
22 2. the lighting in the scene should be quite stable (when doing background
23 subtraction it is recommended to disable auto-gain in the camera, and
24 avoid any artifact introduced by the power line frequency);
25 3. the subject should enter the scene only after the background learning
26 phase has finished, i.e. after opencv_trail_effect has shown the preview
33 The effect in "Blame It On The Boogie" could be described as a short faded
34 trail and can be achieved with this command line:
36 $ ./opencv_trail_effect -l 12 -s background -d fadeaccumulate
39 The effect in "WTF?" is equivalent to an infinite trail in which the isolated
40 foreground is copied on the background and stays there, it can be achieved
41 with this command line:
43 $ ./opencv_trail_effect -l -1 -s background -d copy
46 The effect in "L'Anima Vola" seems to have a "catch-up" behavior; that one can
47 be done by drawing the trail in reverse, with this command line:
49 $ ./opencv_trail_effect -l 30 -s background -d copy -r
52 Another effect seen in movies can be obtained by doing the average of the
53 frames in the trail, possibly with the most recent frame drawn on top:
55 $ ./opencv_trail_effect -l 10 -s background -d average -B
57 Here is a video showing the examples from above:
58 https://www.youtube.com/watch?v=X3oRozxt2O4
63 These effects can bring to mind other cool effects in music videos, like the
64 frame shuffling effect in Peter Gabriel's Sledgehammer
65 (https://www.youtube.com/watch?v=OJWJE0x7T4Q), that one can be done with the
66 nervousTV plugin from effectv
67 (https://fukuchi.org/research/effectv/index.html.en) or frei0r filters
68 (https://www.dyne.org/software/frei0r/), for example with:
70 $ gst-launch-1.0 -v v4l2src ! videoconvert ! frei0r-filter-nervous ! videoconvert ! autovideosink