5cc617004a87f90f1aa8f635da1c74359aa477e6
[Faustine.git] / dsp_files / test.dsp
1 import("mrfaustlib/fft.lib");
2
3 DILATION_MIN = 0;
4 EROSION_MAX = 255;
5
6 strel_shift_dilation = DILATION_MIN : vectorize(1);
7 strel_shift_erosion = EROSION_MAX : vectorize(1);
8
9 spray_by_three(n) = _ <: par(i, n, ([i], [i+1], [i+2]));
10
11 tri_max = max, _ : max;
12 tri_maxs(n) = par(i, n, tri_max);
13 tri_min = min, _ : min;
14 tri_mins(n) = par(i, n, tri_min);
15
16 dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n);
17
18 eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n);
19
20 dilation(size, iter) = seq(i, iter, dilating(size));
21 erosion(size, iter) = seq(i, iter, eroding(size));
22
23 opening(size, iter) = erosion(size, iter) : dilation(size, iter);
24
25 //process = dilation(112, 3);
26 //process = erosion(119, 10);
27 process = opening(119, 2);