0e0e0c88b59bca43e29f23b3ba92e278246a855d
[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 OpenCV.
15
16 Segmentation in opencv_trail_effect can done using either thresholding or
17 background subtraction.
18
19 A few conditions are required to create a decent effect:
20
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 showed the preview
27      window.
28
29
30 Examples of use
31 ---------------
32
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:
35
36   $ ./opencv_trail_effect -l 12 -s background -d fadeaccumulate
37
38
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:
42
43   $ ./opencv_trail_effect -l -1 -s background -d copy
44
45
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:
48
49   $ ./opencv_trail_effect -l 30 -s background -d copy -r
50
51
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:
54
55   $ ./opencv_trail_effect -l 10 -s background -d average -B
56
57 Here is a video showing the examples from above:
58 https://www.youtube.com/watch?v=X3oRozxt2O4
59
60 Side note
61 -------------------
62
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:
69
70   $ gst-launch-1.0 -v v4l2src ! videoconvert ! frei0r-filter-nervous ! videoconvert ! autovideosink