cd242b0566b3532fa2bef79ae12c5ec482822d59
[experiments/opencv_trail_effect.git] / README
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.
4
5 [1] http://dailypsychedelicvideo.com/tag/trail-effect/
6
7 Some examples of it are:
8
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
12
13 opencv_trail_effect draws a trail after performing foreground segmentation
14 (using thresholding or background subtraction) using OpenCV.
15
16 The "sole" assumptions for a decent effect are that:
17
18   1. the camera does not move;
19   2. the background lighting in the scene is quite stable (when doing
20      background subtraction it is recommended to disable auto-gain in the
21      camera, and avoiding any artifact introduced by the power line
22      frequency).
23
24
25 Examples of use
26 ---------------
27
28 The effect in "Blame It On The Boogie" could be described as a short faded
29 trail and can be achieved with this command line:
30
31   $ ./opencv_trail_effect -l 12 -s background -d fadeaccumulate
32
33
34 The effect in "WTF?" is equivalent to an infinite trail in which the isolated
35 foreground is copied on the background and stays there, it can be achieved
36 with this command line:
37
38   $ ./opencv_trail_effect -l -1 -s background -d copy
39
40
41 The effect in "L'Anima Vola" seems to have a "catch-up" behavior; that one can
42 be done by drawing the trail in reverse, with this command line:
43
44   $ ./opencv_trail_effect -l 30 -s background -d copy -r
45
46
47 Another effect seen in movies can be obtained by doing the average of the
48 frames in the trail, possibly with the most recent frame drawn on top:
49
50   $ ./opencv_trail_effect -l 10 -s background -d average -B
51
52
53 Side note
54 -------------------
55
56 These effects can bring to mind other cool effects in music videos, like the
57 frame shuffling effect in Peter Gabriel's Sledgehammer
58 (https://www.youtube.com/watch?v=OJWJE0x7T4Q), that one can be done with the
59 nervousTV plugin from effectv
60 (https://fukuchi.org/research/effectv/index.html.en) or frei0r filters
61 (https://www.dyne.org/software/frei0r/), for example with:
62
63   $ gst-launch-1.0 -v v4l2src ! videoconvert ! frei0r-filter-nervous ! videoconvert ! autovideosink