Impacts¶
mg_impacts ¶
mg_impacts(self, title=None, detection=True, local_mean=0.1, local_maxima=0.15, filtertype='Adaptative', threshold=0.05, kernel_size=5, convert=True, target_name=None, overwrite=True)
Compute a visual analogue of an onset envelope, aslo known as an impact envelope (Abe Davis). This is computed by summing over positive entries in the columns of the directogram. This gives an impact envelope with precisely the same form as an onset envelope. To account for large outlying spikes that sometimes happen at shot boundaries (i.e., cuts), the 99th percentile of the impact envelope values are clipped to the 98th percentile. Then, the impact envelopes are normalized by their maximum to make calculations more consistent across video resolutions. Fianlly, the local mean of the impact envelopes are calculated using a 0.1-second window, and local maxima using a 0.15-second window. Impacts are defined as local maxima that are above their local mean by at least 10% of the envelope’s global maximum.
Source: Abe Davis -- Visual Rhythm and Beat (section 4.2 and 4.3)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Optionally add title to the figure. Defaults to None, which uses 'Directogram' as a title. Defaults to None. |
None
|
detection
|
bool
|
Whether to allow the detection of impacts based on local mean and local maxima or not. |
True
|
local_mean
|
float
|
Size of the local mean window in seconds which reduces the amount of intensity variation between one impact and the next. |
0.1
|
local_maxima
|
float
|
Size of the local maxima window in seconds for the impact envelopes |
0.15
|
filtertype
|
str
|
'Regular' turns all values below |
'Adaptative'
|
threshold
|
float
|
Eliminates pixel values less than given threshold. Ranges from 0 to 1. Defaults to 0.05. |
0.05
|
kernel_size
|
int
|
Size of structuring element. Defaults to 5. |
5
|
convert
|
bool
|
If True (default), non-AVI input is first converted to an all-intra MJPEG |
True
|
target_name
|
str
|
Target output name for the impacts figure. Defaults to None (which assumes that the input filename with the suffix "_impacts" should be used). |
None
|
overwrite
|
bool
|
Whether to allow overwriting existing files or to automatically increment target filenames to avoid overwriting. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
MgFigure |
'MgFigure'
|
An MgFigure object referring to the internal figure and its data. |
Source code in musicalgestures/_impacts.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |