blob: 2e9efabdb6aa1c82dc2048b9dfe164479586edad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|
#N canvas 1 49 1424 780 10;
#X obj -191 -148 cnv 15 621 250 empty empty empty 20 12 0 14 -260097
-66577 0;
#X obj -175 -111 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1
0 1;
#X obj -175 -84 metro 40;
#X msg -130 -28 close;
#X obj -155 14 pdp_v4l;
#X msg -137 -55 open /dev/video0;
#X obj -30 -111 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1
0 1;
#X obj -30 -84 metro 40;
#X msg 34 -65 close;
#X msg 30 -89 open /dev/video0;
#X obj -10 14 pdp_v4l2;
#X msg 31 -13 format \$1;
#X obj 32 -35 hradio 15 1 0 4 empty empty empty 0 -8 0 10 -262144 -1
-1 0;
#X text -145 -113 Camera input;
#X text -188 -181 written by yves degoyon ( ydegoyon@gmail.com );
#X text 376 -143 input 1;
#X obj 440 -146 cnv 15 250 250 empty empty empty 20 12 0 14 -260097
-66577 0;
#X obj 473 -94 openpanel;
#X msg 454 -123 bang;
#X obj 453 -26 pdp_background;
#X obj 453 51 pdp_imgloader;
#X obj 453 -49 metro 40;
#X msg 472 -70 load \$1 0 0;
#X floatatom 548 -24 5 0 0 0 - - -;
#X text 500 -124 loading a pattern image;
#X text 448 -143 input 2 ( pattern );
#X obj -11 43 pdp_scale 320 240;
#X obj 453 81 pdp_xv;
#X obj -11 74 pdp_xv;
#X text -187 -211 pdp_opencv_dft : discrete fourier transform;
#X text -187 -197 this can be used for pattern matching;
#X obj 453 21 pdp_scale 320 240;
#X obj 453 -2 pdp_convert image/YCrCb/*;
#X obj 216 65 pdp_qt;
#X obj 249 1 metro 40;
#X msg 249 -27 bang;
#X msg 290 -27 stop;
#X obj 216 -96 openpanel;
#X msg 216 -71 open \$1;
#X msg 216 -124 bang;
#X msg 250 28 loop \$1;
#X obj 330 28 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 330 -54 loadbang;
#X text 267 -123 playing a video file;
#X obj 559 -51 s max;
#X msg 518 -49 0;
#X obj -189 109 cnv 15 880 150 empty empty empty 20 12 0 14 -258113
-66577 0;
#X obj -58 192 pdp_opencv_dft;
#X obj 215 206 pdp_opencv_dft;
#X msg -30 158 bang;
#X msg 206 175 bang;
#X obj 114 140 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 113 114 loadbang;
#X text 302 185 <-- Calculate Discrete Fourier Transform of the pattern
;
#X text 324 196 pdp_opencv_dft is too greedy to be calculayed for every
;
#X text 322 209 frame so it is just processed when it receives a bang
;
#X obj -187 267 cnv 15 880 200 empty empty empty 20 12 0 14 -4034 -66577
0;
#X obj 1 381 pdp_xv;
#X obj 108 331 pdp_hue;
#X floatatom 108 358 5 0 0 0 - - -;
#X floatatom 132 271 5 0 0 0 - - -;
#X obj 36 269 loadbang;
#X obj 110 292 pdp_binary ----------------;
#X obj -67 292 pdp_binary --------------;
#X floatatom 109 401 5 0 0 0 - - -;
#X msg 97 269 60;
#X obj -1 343 pdp_mul;
#X text 220 390 when it's close to its maximum;
#X text 310 307 60 is a good value to eliminate noise;
#X text 312 319 while keeping meaningful points;
#X text 286 295 <-- Threshold the fft to eliminate noise;
#X text 458 116 processing discrete fourier transform;
#X text 485 270 analyzing/comparing dft outputs;
#X text -115 343 multiply dfts -->;
#X text 201 377 <- average value of dft(i1) x dft(i2);
#X text 221 403 the input image the closest to the pattern;
#N canvas 30 169 449 300 cmax 0;
#X obj 70 144 route 1;
#X msg 122 144 bang;
#X obj 42 70 t f b;
#X obj 89 95 f;
#X obj 120 95 r max;
#X obj 43 144 >;
#X obj 56 119 f 0;
#X obj 45 44 inlet;
#X obj 73 180 outlet;
#X obj 163 52 route 1;
#X msg 218 44 \; ctest color 13 13;
#X obj 339 49 del 100;
#X msg 396 45 \; ctest color 0 0;
#X obj 120 53 inlet;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 1 0 6 0;
#X connect 2 0 3 1;
#X connect 2 0 5 0;
#X connect 2 1 6 0;
#X connect 3 0 6 1;
#X connect 4 0 6 1;
#X connect 5 0 0 0;
#X connect 6 0 5 1;
#X connect 6 0 8 0;
#X connect 7 0 2 0;
#X connect 9 0 10 0;
#X connect 9 0 11 0;
#X connect 11 0 12 0;
#X connect 13 0 9 0;
#X restore 109 377 pd cmax;
#X text 285 -110 ( try estrella.mov );
#X text 499 -111 ( try estrella.jpg );
#X obj 531 361 cnv 15 100 60 empty ctest empty 20 12 0 14 -262144 -262144
0;
#X text 377 436 ( fft product average > 5 for the estrella example
);
#X text 454 422 when the ffts are close to the pattern;
#X text 505 449 this test pad should turn red;
#X obj 151 357 > 5;
#X obj 114 164 metro 100;
#X obj 29 222 pdp_spigot;
#X obj 30 241 pdp_xv;
#X obj 94 200 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 106 230 <-- also outputs phase diagram;
#X text 110 240 ( necessary for reverse dft );
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 4 0 26 0;
#X connect 5 0 4 0;
#X connect 6 0 7 0;
#X connect 7 0 10 0;
#X connect 8 0 10 0;
#X connect 9 0 10 0;
#X connect 10 0 26 0;
#X connect 11 0 10 0;
#X connect 12 0 11 0;
#X connect 17 0 22 0;
#X connect 18 0 17 0;
#X connect 18 0 21 0;
#X connect 19 0 32 0;
#X connect 20 0 27 0;
#X connect 20 0 48 0;
#X connect 21 0 19 0;
#X connect 22 0 20 0;
#X connect 22 0 45 0;
#X connect 23 0 19 3;
#X connect 26 0 28 0;
#X connect 26 0 47 0;
#X connect 31 0 20 0;
#X connect 32 0 31 0;
#X connect 33 0 26 0;
#X connect 34 0 33 0;
#X connect 35 0 34 0;
#X connect 36 0 34 0;
#X connect 37 0 38 0;
#X connect 38 0 33 0;
#X connect 39 0 37 0;
#X connect 40 0 33 0;
#X connect 41 0 40 0;
#X connect 42 0 41 0;
#X connect 42 0 35 0;
#X connect 45 0 44 0;
#X connect 47 0 63 0;
#X connect 47 1 85 0;
#X connect 48 0 62 0;
#X connect 49 0 47 0;
#X connect 50 0 48 0;
#X connect 51 0 84 0;
#X connect 52 0 51 0;
#X connect 58 0 59 0;
#X connect 59 0 76 0;
#X connect 59 0 83 0;
#X connect 60 0 62 6;
#X connect 60 0 63 6;
#X connect 61 0 65 0;
#X connect 62 0 66 1;
#X connect 63 0 66 0;
#X connect 65 0 60 0;
#X connect 66 0 57 0;
#X connect 66 0 58 0;
#X connect 76 0 64 0;
#X connect 83 0 76 1;
#X connect 84 0 47 0;
#X connect 84 0 48 0;
#X connect 85 1 86 0;
#X connect 87 0 85 1;
|