-
Notifications
You must be signed in to change notification settings - Fork 0
/
param.go
518 lines (469 loc) · 54.4 KB
/
param.go
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
package main
import (
"fmt"
"math"
)
var DistanceInDescriptor = [3][Cell_M * Cell_m][Cell_M * Cell_m]float64{
{
{19.79898987322333, 17.204650534085253, 15.231546211727817, 14.142135623730951, 14.142135623730951, 15.231546211727817, 17.204650534085253, 19.79898987322333},
{17.204650534085253, 14.142135623730951, 11.661903789690601, 10.198039027185569, 10.198039027185569, 11.661903789690601, 14.142135623730951, 17.204650534085253},
{15.231546211727817, 11.661903789690601, 8.48528137423857, 6.324555320336759, 6.324555320336759, 8.48528137423857, 11.661903789690601, 15.231546211727817},
{14.142135623730951, 10.198039027185569, 6.324555320336759, 2.8284271247461903, 2.8284271247461903, 6.324555320336759, 10.198039027185569, 14.142135623730951},
{14.142135623730951, 10.198039027185569, 6.324555320336759, 2.8284271247461903, 2.8284271247461903, 6.324555320336759, 10.198039027185569, 14.142135623730951},
{15.231546211727817, 11.661903789690601, 8.48528137423857, 6.324555320336759, 6.324555320336759, 8.48528137423857, 11.661903789690601, 15.231546211727817},
{17.204650534085253, 14.142135623730951, 11.661903789690601, 10.198039027185569, 10.198039027185569, 11.661903789690601, 14.142135623730951, 17.204650534085253},
{19.79898987322333, 17.204650534085253, 15.231546211727817, 14.142135623730951, 14.142135623730951, 15.231546211727817, 17.204650534085253, 19.79898987322333},
},
{
{39.59797974644666, 34.40930106817051, 30.463092423455635, 28.284271247461902, 28.284271247461902, 30.463092423455635, 34.40930106817051, 39.59797974644666},
{34.40930106817051, 28.284271247461902, 23.323807579381203, 20.396078054371138, 20.396078054371138, 23.323807579381203, 28.284271247461902, 34.40930106817051},
{30.463092423455635, 23.323807579381203, 16.97056274847714, 12.649110640673518, 12.649110640673518, 16.97056274847714, 23.323807579381203, 30.463092423455635},
{28.284271247461902, 20.396078054371138, 12.649110640673518, 5.656854249492381, 5.656854249492381, 12.649110640673518, 20.396078054371138, 28.284271247461902},
{28.284271247461902, 20.396078054371138, 12.649110640673518, 5.656854249492381, 5.656854249492381, 12.649110640673518, 20.396078054371138, 28.284271247461902},
{30.463092423455635, 23.323807579381203, 16.97056274847714, 12.649110640673518, 12.649110640673518, 16.97056274847714, 23.323807579381203, 30.463092423455635},
{34.40930106817051, 28.284271247461902, 23.323807579381203, 20.396078054371138, 20.396078054371138, 23.323807579381203, 28.284271247461902, 34.40930106817051},
{39.59797974644666, 34.40930106817051, 30.463092423455635, 28.284271247461902, 28.284271247461902, 30.463092423455635, 34.40930106817051, 39.59797974644666},
},
{
{79.19595949289332, 68.81860213634101, 60.92618484691127, 56.568542494923804, 56.568542494923804, 60.92618484691127, 68.81860213634101, 79.19595949289332},
{68.81860213634101, 56.568542494923804, 46.647615158762406, 40.792156108742276, 40.792156108742276, 46.647615158762406, 56.568542494923804, 68.81860213634101},
{60.92618484691127, 46.647615158762406, 33.94112549695428, 25.298221281347036, 25.298221281347036, 33.94112549695428, 46.647615158762406, 60.92618484691127},
{56.568542494923804, 40.792156108742276, 25.298221281347036, 11.313708498984761, 11.313708498984761, 25.298221281347036, 40.792156108742276, 56.568542494923804},
{56.568542494923804, 40.792156108742276, 25.298221281347036, 11.313708498984761, 11.313708498984761, 25.298221281347036, 40.792156108742276, 56.568542494923804},
{60.92618484691127, 46.647615158762406, 33.94112549695428, 25.298221281347036, 25.298221281347036, 33.94112549695428, 46.647615158762406, 60.92618484691127},
{68.81860213634101, 56.568542494923804, 46.647615158762406, 40.792156108742276, 40.792156108742276, 46.647615158762406, 56.568542494923804, 68.81860213634101},
{79.19595949289332, 68.81860213634101, 60.92618484691127, 56.568542494923804, 56.568542494923804, 60.92618484691127, 68.81860213634101, 79.19595949289332},
},
}
var weightedCommon = [][]float64{
{0.4650431881340563, 0.5609491608144708, 0.635638673826052, 0.676633846161729, 0.676633846161729, 0.635638673826052, 0.5609491608144708, 0.4650431881340563},
{0.5609491608144708, 0.676633846161729, 0.76672659607082, 0.8161762130223398, 0.8161762130223398, 0.76672659607082, 0.676633846161729, 0.5609491608144708},
{0.635638673826052, 0.76672659607082, 0.8688150562628432, 0.9248488132162048, 0.9248488132162048, 0.8688150562628432, 0.76672659607082, 0.635638673826052},
{0.676633846161729, 0.8161762130223398, 0.9248488132162048, 0.9844964370054085, 0.9844964370054085, 0.9248488132162048, 0.8161762130223398, 0.676633846161729},
{0.676633846161729, 0.8161762130223398, 0.9248488132162048, 0.9844964370054085, 0.9844964370054085, 0.9248488132162048, 0.8161762130223398, 0.676633846161729},
{0.635638673826052, 0.76672659607082, 0.8688150562628432, 0.9248488132162048, 0.9248488132162048, 0.8688150562628432, 0.76672659607082, 0.635638673826052},
{0.5609491608144708, 0.676633846161729, 0.76672659607082, 0.8161762130223398, 0.8161762130223398, 0.76672659607082, 0.676633846161729, 0.5609491608144708},
{0.4650431881340563, 0.5609491608144708, 0.635638673826052, 0.676633846161729, 0.676633846161729, 0.635638673826052, 0.5609491608144708, 0.4650431881340563},
}
var weightedSide32 = [][]float64{
{7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
{5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
{4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
{3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
{3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
{4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
{5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
{7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
}
var weightedSide64 = [][]float64{
{0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0},
{7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258},
{3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202},
{1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174},
{1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174},
{3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202},
{7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258},
{0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0},
}
var weightedSide128 = [][]float64{
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 7.020667798504735e-251, 1.0611231537463512e-139, 1.0611231537463512e-139, 7.020667798504735e-251, 0, 0},
{0, 0, 1.0611231537463512e-139, 1.603810890548638e-28, 1.603810890548638e-28, 1.0611231537463512e-139, 0, 0},
{0, 0, 1.0611231537463512e-139, 1.603810890548638e-28, 1.603810890548638e-28, 1.0611231537463512e-139, 0, 0},
{0, 0, 7.020667798504735e-251, 1.0611231537463512e-139, 1.0611231537463512e-139, 7.020667798504735e-251, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
}
//var weightsWithDistance = [3][][]float64{
// weightedCommon,
// weightedCommon,
// weightedCommon,
//}
//var weightsWithDistance = [3][][]float64{
// {{5.242885663363464e-22, 8.533047625744066e-17, 2.543665647376923e-13, 1.3887943864964021e-11, 1.3887943864964021e-11, 2.543665647376923e-13, 8.533047625744066e-17, 5.242885663363464e-22},
// {8.533047625744066e-17, 1.3887943864964021e-11, 4.139937718785167e-8, 0.0000022603294069810542, 0.0000022603294069810542, 4.139937718785167e-8, 1.3887943864964021e-11, 8.533047625744066e-17},
// {2.543665647376923e-13, 4.139937718785167e-8, 0.00012340980408667956, 0.006737946999085467, 0.006737946999085467, 0.00012340980408667956, 4.139937718785167e-8, 2.543665647376923e-13},
// {1.3887943864964021e-11, 0.0000022603294069810542, 0.006737946999085467, 0.36787944117144233, 0.36787944117144233, 0.006737946999085467, 0.0000022603294069810542, 1.3887943864964021e-11},
// {1.3887943864964021e-11, 0.0000022603294069810542, 0.006737946999085467, 0.36787944117144233, 0.36787944117144233, 0.006737946999085467, 0.0000022603294069810542, 1.3887943864964021e-11},
// {2.543665647376923e-13, 4.139937718785167e-8, 0.00012340980408667956, 0.006737946999085467, 0.006737946999085467, 0.00012340980408667956, 4.139937718785167e-8, 2.543665647376923e-13},
// {8.533047625744066e-17, 1.3887943864964021e-11, 4.139937718785167e-8, 0.0000022603294069810542, 0.0000022603294069810542, 4.139937718785167e-8, 1.3887943864964021e-11, 8.533047625744066e-17},
// {5.242885663363464e-22, 8.533047625744066e-17, 2.543665647376923e-13, 1.3887943864964021e-11, 1.3887943864964021e-11, 2.543665647376923e-13, 8.533047625744066e-17, 5.242885663363464e-22}},
// {
// {7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
// {5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
// {4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
// {3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
// {3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
// {4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
// {5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
// {7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
// },
// {{0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0}, {7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258}, {3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202}, {1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174}, {1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174}, {3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202}, {7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258}, {0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0}},
//}
// sigma = 1
var weightsWithSigma1 = [3][][]float64{
{
{7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
{5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
{4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
{3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
{3.720075976020836e-44, 2.6102790696677047e-23, 2.061153622438558e-9, 0.01831563888873418, 0.01831563888873418, 2.061153622438558e-9, 2.6102790696677047e-23, 3.720075976020836e-44},
{4.1863939993042314e-51, 2.9374821117108028e-30, 2.319522830243569e-16, 2.061153622438558e-9, 2.061153622438558e-9, 2.319522830243569e-16, 2.9374821117108028e-30, 4.1863939993042314e-51},
{5.301718666092324e-65, 3.720075976020836e-44, 2.9374821117108028e-30, 2.6102790696677047e-23, 2.6102790696677047e-23, 2.9374821117108028e-30, 3.720075976020836e-44, 5.301718666092324e-65},
{7.55581901971196e-86, 5.301718666092324e-65, 4.1863939993042314e-51, 3.720075976020836e-44, 3.720075976020836e-44, 4.1863939993042314e-51, 5.301718666092324e-65, 7.55581901971196e-86},
},
{
{0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0},
{7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258},
{3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202},
{1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174},
{1.9151695967140057e-174, 4.642455656042647e-91, 1.804851387845415e-35, 1.1253517471925912e-7, 1.1253517471925912e-7, 1.804851387845415e-35, 4.642455656042647e-91, 1.9151695967140057e-174},
{3.071569856457565e-202, 7.445620940050319e-119, 2.8946403116483003e-63, 1.804851387845415e-35, 1.804851387845415e-35, 2.8946403116483003e-63, 7.445620940050319e-119, 3.071569856457565e-202},
{7.900720773506065e-258, 1.9151695967140057e-174, 7.445620940050319e-119, 4.642455656042647e-91, 4.642455656042647e-91, 7.445620940050319e-119, 1.9151695967140057e-174, 7.900720773506065e-258},
{0, 7.900720773506065e-258, 3.071569856457565e-202, 1.9151695967140057e-174, 1.9151695967140057e-174, 3.071569856457565e-202, 7.900720773506065e-258, 0},
},
{
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 7.020667798504735e-251, 1.0611231537463512e-139, 1.0611231537463512e-139, 7.020667798504735e-251, 0, 0},
{0, 0, 1.0611231537463512e-139, 1.603810890548638e-28, 1.603810890548638e-28, 1.0611231537463512e-139, 0, 0},
{0, 0, 1.0611231537463512e-139, 1.603810890548638e-28, 1.603810890548638e-28, 1.0611231537463512e-139, 0, 0},
{0, 0, 7.020667798504735e-251, 1.0611231537463512e-139, 1.0611231537463512e-139, 7.020667798504735e-251, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
},
}
// sigma=1/6
var sigmaSixPerOne = [][]float64{{0.00039366904065507824, 0.0026852001769538205, 0.009657697627537777, 0.01831563888873418, 0.01831563888873418, 0.009657697627537777, 0.0026852001769538205, 0.00039366904065507824},
{0.0026852001769538205, 0.01831563888873418, 0.06587475442640295, 0.12493021219858241, 0.12493021219858241, 0.06587475442640295, 0.01831563888873418, 0.0026852001769538205},
{0.009657697627537777, 0.06587475442640295, 0.23692775868212176, 0.44932896411722156, 0.44932896411722156, 0.23692775868212176, 0.06587475442640295, 0.009657697627537777},
{0.01831563888873418, 0.12493021219858241, 0.44932896411722156, 0.8521437889662113, 0.8521437889662113, 0.44932896411722156, 0.12493021219858241, 0.01831563888873418},
{0.01831563888873418, 0.12493021219858241, 0.44932896411722156, 0.8521437889662113, 0.8521437889662113, 0.44932896411722156, 0.12493021219858241, 0.01831563888873418},
{0.009657697627537777, 0.06587475442640295, 0.23692775868212176, 0.44932896411722156, 0.44932896411722156, 0.23692775868212176, 0.06587475442640295, 0.009657697627537777},
{0.0026852001769538205, 0.01831563888873418, 0.06587475442640295, 0.12493021219858241, 0.12493021219858241, 0.06587475442640295, 0.01831563888873418, 0.0026852001769538205},
{0.00039366904065507824, 0.0026852001769538205, 0.009657697627537777, 0.01831563888873418, 0.01831563888873418, 0.009657697627537777, 0.0026852001769538205, 0.00039366904065507824}}
// var weightsWithDistance = [3][][]float64{
// sigmaSixPerOne,
// sigmaSixPerOne,
// sigmaSixPerOne,
// }
var sigma_5_1 = [][]float64{{0.00039366904065507824, 0.0026852001769538205, 0.009657697627537777, 0.01831563888873418, 0.01831563888873418, 0.009657697627537777, 0.0026852001769538205, 0.00039366904065507824},
{0.0026852001769538205, 0.01831563888873418, 0.06587475442640295, 0.12493021219858241, 0.12493021219858241, 0.06587475442640295, 0.01831563888873418, 0.0026852001769538205},
{0.009657697627537777, 0.06587475442640295, 0.23692775868212176, 0.44932896411722156, 0.44932896411722156, 0.23692775868212176, 0.06587475442640295, 0.009657697627537777},
{0.01831563888873418, 0.12493021219858241, 0.44932896411722156, 0.8521437889662113, 0.8521437889662113, 0.44932896411722156, 0.12493021219858241, 0.01831563888873418},
{0.01831563888873418, 0.12493021219858241, 0.44932896411722156, 0.8521437889662113, 0.8521437889662113, 0.44932896411722156, 0.12493021219858241, 0.01831563888873418},
{0.009657697627537777, 0.06587475442640295, 0.23692775868212176, 0.44932896411722156, 0.44932896411722156, 0.23692775868212176, 0.06587475442640295, 0.009657697627537777},
{0.0026852001769538205, 0.01831563888873418, 0.06587475442640295, 0.12493021219858241, 0.12493021219858241, 0.06587475442640295, 0.01831563888873418, 0.0026852001769538205},
{0.00039366904065507824, 0.0026852001769538205, 0.009657697627537777, 0.01831563888873418, 0.01831563888873418, 0.009657697627537777, 0.0026852001769538205, 0.00039366904065507824}}
var sigma_5_2 = [][]float64{{2.4017347816209608e-14, 5.1988425950305175e-11, 8.699502472413725e-9, 1.1253517471925912e-7, 1.1253517471925912e-7, 8.699502472413725e-9, 5.1988425950305175e-11, 2.4017347816209608e-14},
{5.1988425950305175e-11, 1.1253517471925912e-7, 0.000018831115057022737, 0.0002435958642256188, 0.0002435958642256188, 0.000018831115057022737, 1.1253517471925912e-7, 5.1988425950305175e-11},
{8.699502472413725e-9, 0.000018831115057022737, 0.003151111598444441, 0.040762203978366204, 0.040762203978366204, 0.003151111598444441, 0.000018831115057022737, 8.699502472413725e-9},
{1.1253517471925912e-7, 0.0002435958642256188, 0.040762203978366204, 0.5272924240430485, 0.5272924240430485, 0.040762203978366204, 0.0002435958642256188, 1.1253517471925912e-7},
{1.1253517471925912e-7, 0.0002435958642256188, 0.040762203978366204, 0.5272924240430485, 0.5272924240430485, 0.040762203978366204, 0.0002435958642256188, 1.1253517471925912e-7},
{8.699502472413725e-9, 0.000018831115057022737, 0.003151111598444441, 0.040762203978366204, 0.040762203978366204, 0.003151111598444441, 0.000018831115057022737, 8.699502472413725e-9},
{5.1988425950305175e-11, 1.1253517471925912e-7, 0.000018831115057022737, 0.0002435958642256188, 0.0002435958642256188, 0.000018831115057022737, 1.1253517471925912e-7, 5.1988425950305175e-11},
{2.4017347816209608e-14, 5.1988425950305175e-11, 8.699502472413725e-9, 1.1253517471925912e-7, 1.1253517471925912e-7, 8.699502472413725e-9, 5.1988425950305175e-11, 2.4017347816209608e-14}}
var sigma_5_3 = [][]float64{{3.327363054183002e-55, 7.30510855710432e-42, 5.727665718778087e-33, 1.603810890548638e-28, 1.603810890548638e-28, 5.727665718778087e-33, 7.30510855710432e-42, 3.327363054183002e-55},
{7.30510855710432e-42, 1.603810890548638e-28, 1.257488863497411e-19, 3.5211104017624837e-15, 3.5211104017624837e-15, 1.257488863497411e-19, 1.603810890548638e-28, 7.30510855710432e-42},
{5.727665718778087e-33, 1.257488863497411e-19, 9.859505575991517e-11, 0.0000027607725720371986, 0.0000027607725720371986, 9.859505575991517e-11, 1.257488863497411e-19, 5.727665718778087e-33},
{1.603810890548638e-28, 3.5211104017624837e-15, 0.0000027607725720371986, 0.07730474044329974, 0.07730474044329974, 0.0000027607725720371986, 3.5211104017624837e-15, 1.603810890548638e-28},
{1.603810890548638e-28, 3.5211104017624837e-15, 0.0000027607725720371986, 0.07730474044329974, 0.07730474044329974, 0.0000027607725720371986, 3.5211104017624837e-15, 1.603810890548638e-28},
{5.727665718778087e-33, 1.257488863497411e-19, 9.859505575991517e-11, 0.0000027607725720371986, 0.0000027607725720371986, 9.859505575991517e-11, 1.257488863497411e-19, 5.727665718778087e-33},
{7.30510855710432e-42, 1.603810890548638e-28, 1.257488863497411e-19, 3.5211104017624837e-15, 3.5211104017624837e-15, 1.257488863497411e-19, 1.603810890548638e-28, 7.30510855710432e-42},
{3.327363054183002e-55, 7.30510855710432e-42, 5.727665718778087e-33, 1.603810890548638e-28, 1.603810890548638e-28, 5.727665718778087e-33, 7.30510855710432e-42, 3.327363054183002e-55}}
// sigma=5
//
// var weightsWithDistance = [3][][]float64{
// sigma_5_1,
// sigma_5_2,
// sigma_5_3,
// }
//
// sigma=2
var weightsWithSigma2 = [3][][]float64{
{{3.4358548573244435e-22, 5.592018406498112e-17, 1.6669571932534906e-13, 9.10127789360831e-12, 9.10127789360831e-12, 1.6669571932534906e-13, 5.592018406498112e-17, 3.4358548573244435e-22},
{5.592018406498112e-17, 9.10127789360831e-12, 2.713052702923801e-8, 0.0000014812765852206118, 0.0000014812765852206118, 2.713052702923801e-8, 9.10127789360831e-12, 5.592018406498112e-17},
{1.6669571932534906e-13, 2.713052702923801e-8, 0.00008087496124045854, 0.00441562326773128, 0.00441562326773128, 0.00008087496124045854, 2.713052702923801e-8, 1.6669571932534906e-13},
{9.10127789360831e-12, 0.0000014812765852206118, 0.00441562326773128, 0.24108486166143508, 0.24108486166143508, 0.00441562326773128, 0.0000014812765852206118, 9.10127789360831e-12},
{9.10127789360831e-12, 0.0000014812765852206118, 0.00441562326773128, 0.24108486166143508, 0.24108486166143508, 0.00441562326773128, 0.0000014812765852206118, 9.10127789360831e-12},
{1.6669571932534906e-13, 2.713052702923801e-8, 0.00008087496124045854, 0.00441562326773128, 0.00441562326773128, 0.00008087496124045854, 2.713052702923801e-8, 1.6669571932534906e-13},
{5.592018406498112e-17, 9.10127789360831e-12, 2.713052702923801e-8, 0.0000014812765852206118, 0.0000014812765852206118, 2.713052702923801e-8, 9.10127789360831e-12, 5.592018406498112e-17},
{3.4358548573244435e-22, 5.592018406498112e-17, 1.6669571932534906e-13, 9.10127789360831e-12, 9.10127789360831e-12, 1.6669571932534906e-13, 5.592018406498112e-17, 3.4358548573244435e-22}},
{{1.0313341190310524e-84, 7.23659915037676e-64, 5.71423290569221e-50, 5.077730513990382e-43, 5.077730513990382e-43, 5.71423290569221e-50, 7.23659915037676e-64, 1.0313341190310524e-84},
{7.23659915037676e-64, 5.077730513990382e-43, 4.0095263239460527e-29, 3.562909404947028e-22, 3.562909404947028e-22, 4.0095263239460527e-29, 5.077730513990382e-43, 7.23659915037676e-64},
{5.71423290569221e-50, 4.0095263239460527e-29, 3.1660406746916228e-15, 2.8133787347733075e-8, 2.8133787347733075e-8, 3.1660406746916228e-15, 4.0095263239460527e-29, 5.71423290569221e-50},
{5.077730513990382e-43, 3.562909404947028e-22, 2.8133787347733075e-8, 0.24999994373242213, 0.24999994373242213, 2.8133787347733075e-8, 3.562909404947028e-22, 5.077730513990382e-43},
{5.077730513990382e-43, 3.562909404947028e-22, 2.8133787347733075e-8, 0.24999994373242213, 0.24999994373242213, 2.8133787347733075e-8, 3.562909404947028e-22, 5.077730513990382e-43},
{5.71423290569221e-50, 4.0095263239460527e-29, 3.1660406746916228e-15, 2.8133787347733075e-8, 2.8133787347733075e-8, 3.1660406746916228e-15, 4.0095263239460527e-29, 5.71423290569221e-50},
{7.23659915037676e-64, 5.077730513990382e-43, 4.0095263239460527e-29, 3.562909404947028e-22, 3.562909404947028e-22, 4.0095263239460527e-29, 5.077730513990382e-43, 7.23659915037676e-64},
{1.0313341190310524e-84, 7.23659915037676e-64, 5.71423290569221e-50, 5.077730513990382e-43, 5.077730513990382e-43, 5.71423290569221e-50, 7.23659915037676e-64, 1.0313341190310524e-84}},
{{0, 1.7551669496261837e-251, 6.823577303985606e-196, 4.254602175479287e-168, 4.254602175479287e-168, 6.823577303985606e-196, 1.7551669496261837e-251, 0},
{1.7551669496261837e-251, 4.254602175479287e-168, 1.6540652641773713e-112, 1.031334351153796e-84, 1.031334351153796e-84, 1.6540652641773713e-112, 4.254602175479287e-168, 1.7551669496261837e-251},
{6.823577303985606e-196, 1.6540652641773713e-112, 6.430523431606037e-57, 4.009527226371594e-29, 4.009527226371594e-29, 6.430523431606037e-57, 1.6540652641773713e-112, 6.823577303985606e-196},
{4.254602175479287e-168, 1.031334351153796e-84, 4.009527226371594e-29, 0.25, 0.25, 4.009527226371594e-29, 1.031334351153796e-84, 4.254602175479287e-168},
{4.254602175479287e-168, 1.031334351153796e-84, 4.009527226371594e-29, 0.25, 0.25, 4.009527226371594e-29, 1.031334351153796e-84, 4.254602175479287e-168},
{6.823577303985606e-196, 1.6540652641773713e-112, 6.430523431606037e-57, 4.009527226371594e-29, 4.009527226371594e-29, 6.430523431606037e-57, 1.6540652641773713e-112, 6.823577303985606e-196},
{1.7551669496261837e-251, 4.254602175479287e-168, 1.6540652641773713e-112, 1.031334351153796e-84, 1.031334351153796e-84, 1.6540652641773713e-112, 4.254602175479287e-168, 1.7551669496261837e-251},
{0, 1.7551669496261837e-251, 6.823577303985606e-196, 4.254602175479287e-168, 4.254602175479287e-168, 6.823577303985606e-196, 1.7551669496261837e-251, 0}},
}
var newWeightComm = [][]float64{{0.0020330718714528856, 0.00430401318564052, 0.007096118088539345, 0.009111595985502152, 0.009111595985502152, 0.007096118088539345, 0.00430401318564052, 0.0020330718714528856},
{0.00430401318564052, 0.009111595985502152, 0.015022482111323295, 0.019289248852676036, 0.019289248852676036, 0.015022482111323295, 0.009111595985502152, 0.00430401318564052},
{0.007096118088539345, 0.015022482111323295, 0.024767885795650885, 0.03180259487923502, 0.03180259487923502, 0.024767885795650885, 0.015022482111323295, 0.007096118088539345},
{0.009111595985502152, 0.019289248852676036, 0.03180259487923502, 0.04083534014156119, 0.04083534014156119, 0.03180259487923502, 0.019289248852676036, 0.009111595985502152},
{0.009111595985502152, 0.019289248852676036, 0.03180259487923502, 0.04083534014156119, 0.04083534014156119, 0.03180259487923502, 0.019289248852676036, 0.009111595985502152},
{0.007096118088539345, 0.015022482111323295, 0.024767885795650885, 0.03180259487923502, 0.03180259487923502, 0.024767885795650885, 0.015022482111323295, 0.007096118088539345},
{0.00430401318564052, 0.009111595985502152, 0.015022482111323295, 0.019289248852676036, 0.019289248852676036, 0.015022482111323295, 0.009111595985502152, 0.00430401318564052},
{0.0020330718714528856, 0.00430401318564052, 0.007096118088539345, 0.009111595985502152, 0.009111595985502152, 0.007096118088539345, 0.00430401318564052, 0.0020330718714528856}}
// sigma=s/4 total sum =1
//var weightsWithDistance = [3][][]float64{
// newWeightComm,
// newWeightComm,
// newWeightComm,
//}
// sigma=4
var weightSigma4 = [][]float64{
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060813, 0.00030726109858346385, 0.00030726109858346385, 0.00011303504124060813, 0.00001529762932195991, 7.616241169186581e-7},
{0.00001529762932195991, 0.00030726109858346385, 0.0022703694944522772, 0.006171504140657378, 0.006171504140657378, 0.0022703694944522772, 0.00030726109858346385, 0.00001529762932195991},
{0.00011303504124060813, 0.0022703694944522772, 0.016775887559808706, 0.045601590310100124, 0.045601590310100124, 0.016775887559808706, 0.0022703694944522772, 0.00011303504124060813},
{0.00030726109858346385, 0.006171504140657378, 0.045601590310100124, 0.12395797428877928, 0.12395797428877928, 0.045601590310100124, 0.006171504140657378, 0.00030726109858346385},
{0.00030726109858346385, 0.006171504140657378, 0.045601590310100124, 0.12395797428877928, 0.12395797428877928, 0.045601590310100124, 0.006171504140657378, 0.00030726109858346385},
{0.00011303504124060813, 0.0022703694944522772, 0.016775887559808706, 0.045601590310100124, 0.045601590310100124, 0.016775887559808706, 0.0022703694944522772, 0.00011303504124060813},
{0.00001529762932195991, 0.00030726109858346385, 0.0022703694944522772, 0.006171504140657378, 0.006171504140657378, 0.0022703694944522772, 0.00030726109858346385, 0.00001529762932195991},
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060813, 0.00030726109858346385, 0.00030726109858346385, 0.00011303504124060813, 0.00001529762932195991, 7.616241169186581e-7},
}
// sigma=4
var weightsWithSigma4 = [][][]float64{
{
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060813, 0.00030726109858346385, 0.00030726109858346385, 0.00011303504124060813, 0.00001529762932195991, 7.616241169186581e-7},
{0.00001529762932195991, 0.00030726109858346385, 0.0022703694944522772, 0.006171504140657378, 0.006171504140657378, 0.0022703694944522772, 0.00030726109858346385, 0.00001529762932195991},
{0.00011303504124060813, 0.0022703694944522772, 0.016775887559808706, 0.045601590310100124, 0.045601590310100124, 0.016775887559808706, 0.0022703694944522772, 0.00011303504124060813},
{0.00030726109858346385, 0.006171504140657378, 0.045601590310100124, 0.12395797428877928, 0.12395797428877928, 0.045601590310100124, 0.006171504140657378, 0.00030726109858346385},
{0.00030726109858346385, 0.006171504140657378, 0.045601590310100124, 0.12395797428877928, 0.12395797428877928, 0.045601590310100124, 0.006171504140657378, 0.00030726109858346385},
{0.00011303504124060813, 0.0022703694944522772, 0.016775887559808706, 0.045601590310100124, 0.045601590310100124, 0.016775887559808706, 0.0022703694944522772, 0.00011303504124060813},
{0.00001529762932195991, 0.00030726109858346385, 0.0022703694944522772, 0.006171504140657378, 0.006171504140657378, 0.0022703694944522772, 0.00030726109858346385, 0.00001529762932195991},
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060813, 0.00030726109858346385, 0.00030726109858346385, 0.00011303504124060813, 0.00001529762932195991, 7.616241169186581e-7},
},
{
{3.4358548573244444e-22, 5.592018406498115e-17, 1.666957193253485e-13, 9.10127789360828e-12, 9.10127789360828e-12, 1.666957193253485e-13, 5.592018406498115e-17, 3.4358548573244444e-22},
{5.592018406498115e-17, 9.10127789360828e-12, 2.7130527029238017e-8, 0.000001481276585220615, 0.000001481276585220615, 2.7130527029238017e-8, 9.10127789360828e-12, 5.592018406498115e-17},
{1.666957193253485e-13, 2.7130527029238017e-8, 0.0000808749612404587, 0.004415623267731278, 0.004415623267731278, 0.0000808749612404587, 2.7130527029238017e-8, 1.666957193253485e-13},
{9.10127789360828e-12, 0.000001481276585220615, 0.004415623267731278, 0.24108486166143508, 0.24108486166143508, 0.004415623267731278, 0.000001481276585220615, 9.10127789360828e-12},
{9.10127789360828e-12, 0.000001481276585220615, 0.004415623267731278, 0.24108486166143508, 0.24108486166143508, 0.004415623267731278, 0.000001481276585220615, 9.10127789360828e-12},
{1.666957193253485e-13, 2.7130527029238017e-8, 0.0000808749612404587, 0.004415623267731278, 0.004415623267731278, 0.0000808749612404587, 2.7130527029238017e-8, 1.666957193253485e-13},
{5.592018406498115e-17, 9.10127789360828e-12, 2.7130527029238017e-8, 0.000001481276585220615, 0.000001481276585220615, 2.7130527029238017e-8, 9.10127789360828e-12, 5.592018406498115e-17},
{3.4358548573244444e-22, 5.592018406498115e-17, 1.666957193253485e-13, 9.10127789360828e-12, 9.10127789360828e-12, 1.666957193253485e-13, 5.592018406498115e-17, 3.4358548573244444e-22},
},
{
{1.031334119031053e-84, 7.236599150376765e-64, 5.714232905692134e-50, 5.0777305139903144e-43, 5.0777305139903144e-43, 5.714232905692134e-50, 7.236599150376765e-64, 1.031334119031053e-84},
{7.236599150376765e-64, 5.0777305139903144e-43, 4.009526323946056e-29, 3.562909404947056e-22, 3.562909404947056e-22, 4.009526323946056e-29, 5.0777305139903144e-43, 7.236599150376765e-64},
{5.714232905692134e-50, 4.009526323946056e-29, 3.166040674691648e-15, 2.8133787347732992e-8, 2.8133787347732992e-8, 3.166040674691648e-15, 4.009526323946056e-29, 5.714232905692134e-50},
{5.0777305139903144e-43, 3.562909404947056e-22, 2.8133787347732992e-8, 0.24999994373242213, 0.24999994373242213, 2.8133787347732992e-8, 3.562909404947056e-22, 5.0777305139903144e-43},
{5.0777305139903144e-43, 3.562909404947056e-22, 2.8133787347732992e-8, 0.24999994373242213, 0.24999994373242213, 2.8133787347732992e-8, 3.562909404947056e-22, 5.0777305139903144e-43},
{5.714232905692134e-50, 4.009526323946056e-29, 3.166040674691648e-15, 2.8133787347732992e-8, 2.8133787347732992e-8, 3.166040674691648e-15, 4.009526323946056e-29, 5.714232905692134e-50},
{7.236599150376765e-64, 5.0777305139903144e-43, 4.009526323946056e-29, 3.562909404947056e-22, 3.562909404947056e-22, 4.009526323946056e-29, 5.0777305139903144e-43, 7.236599150376765e-64},
{1.031334119031053e-84, 7.236599150376765e-64, 5.714232905692134e-50, 5.0777305139903144e-43, 5.0777305139903144e-43, 5.714232905692134e-50, 7.236599150376765e-64, 1.031334119031053e-84},
},
}
var weightsWithSigma4Same = [][][]float64{
weightSigma4,
weightSigma4,
weightSigma4,
}
var weightsWithSigma8 = [][][]float64{
{{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886}},
{{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060822, 0.0003072610985834641, 0.0003072610985834641, 0.00011303504124060822, 0.00001529762932195991, 7.616241169186581e-7},
{0.00001529762932195991, 0.0003072610985834641, 0.0022703694944522772, 0.006171504140657374, 0.006171504140657374, 0.0022703694944522772, 0.0003072610985834641, 0.00001529762932195991},
{0.00011303504124060822, 0.0022703694944522772, 0.016775887559808696, 0.04560159031010013, 0.04560159031010013, 0.016775887559808696, 0.0022703694944522772, 0.00011303504124060822},
{0.0003072610985834641, 0.006171504140657374, 0.04560159031010013, 0.12395797428877928, 0.12395797428877928, 0.04560159031010013, 0.006171504140657374, 0.0003072610985834641},
{0.0003072610985834641, 0.006171504140657374, 0.04560159031010013, 0.12395797428877928, 0.12395797428877928, 0.04560159031010013, 0.006171504140657374, 0.0003072610985834641},
{0.00011303504124060822, 0.0022703694944522772, 0.016775887559808696, 0.04560159031010013, 0.04560159031010013, 0.016775887559808696, 0.0022703694944522772, 0.00011303504124060822},
{0.00001529762932195991, 0.0003072610985834641, 0.0022703694944522772, 0.006171504140657374, 0.006171504140657374, 0.0022703694944522772, 0.0003072610985834641, 0.00001529762932195991},
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060822, 0.0003072610985834641, 0.0003072610985834641, 0.00011303504124060822, 0.00001529762932195991, 7.616241169186581e-7}},
{{3.4358548573244435e-22, 5.592018406498112e-17, 1.6669571932534906e-13, 9.10127789360831e-12, 9.10127789360831e-12, 1.6669571932534906e-13, 5.592018406498112e-17, 3.4358548573244435e-22},
{5.592018406498112e-17, 9.10127789360831e-12, 2.713052702923801e-8, 0.0000014812765852206118, 0.0000014812765852206118, 2.713052702923801e-8, 9.10127789360831e-12, 5.592018406498112e-17},
{1.6669571932534906e-13, 2.713052702923801e-8, 0.00008087496124045854, 0.00441562326773128, 0.00441562326773128, 0.00008087496124045854, 2.713052702923801e-8, 1.6669571932534906e-13},
{9.10127789360831e-12, 0.0000014812765852206118, 0.00441562326773128, 0.24108486166143508, 0.24108486166143508, 0.00441562326773128, 0.0000014812765852206118, 9.10127789360831e-12},
{9.10127789360831e-12, 0.0000014812765852206118, 0.00441562326773128, 0.24108486166143508, 0.24108486166143508, 0.00441562326773128, 0.0000014812765852206118, 9.10127789360831e-12},
{1.6669571932534906e-13, 2.713052702923801e-8, 0.00008087496124045854, 0.00441562326773128, 0.00441562326773128, 0.00008087496124045854, 2.713052702923801e-8, 1.6669571932534906e-13},
{5.592018406498112e-17, 9.10127789360831e-12, 2.713052702923801e-8, 0.0000014812765852206118, 0.0000014812765852206118, 2.713052702923801e-8, 9.10127789360831e-12, 5.592018406498112e-17},
{3.4358548573244435e-22, 5.592018406498112e-17, 1.6669571932534906e-13, 9.10127789360831e-12, 9.10127789360831e-12, 1.6669571932534906e-13, 5.592018406498112e-17, 3.4358548573244435e-22}},
}
var weightsWithSigma16 = [][][]float64{
{
{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563},
},
{
{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886},
},
{
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060822, 0.0003072610985834641, 0.0003072610985834641, 0.00011303504124060822, 0.00001529762932195991, 7.616241169186581e-7},
{0.00001529762932195991, 0.0003072610985834641, 0.0022703694944522772, 0.006171504140657374, 0.006171504140657374, 0.0022703694944522772, 0.0003072610985834641, 0.00001529762932195991},
{0.00011303504124060822, 0.0022703694944522772, 0.016775887559808696, 0.04560159031010013, 0.04560159031010013, 0.016775887559808696, 0.0022703694944522772, 0.00011303504124060822},
{0.0003072610985834641, 0.006171504140657374, 0.04560159031010013, 0.12395797428877928, 0.12395797428877928, 0.04560159031010013, 0.006171504140657374, 0.0003072610985834641},
{0.0003072610985834641, 0.006171504140657374, 0.04560159031010013, 0.12395797428877928, 0.12395797428877928, 0.04560159031010013, 0.006171504140657374, 0.0003072610985834641},
{0.00011303504124060822, 0.0022703694944522772, 0.016775887559808696, 0.04560159031010013, 0.04560159031010013, 0.016775887559808696, 0.0022703694944522772, 0.00011303504124060822},
{0.00001529762932195991, 0.0003072610985834641, 0.0022703694944522772, 0.006171504140657374, 0.006171504140657374, 0.0022703694944522772, 0.0003072610985834641, 0.00001529762932195991},
{7.616241169186581e-7, 0.00001529762932195991, 0.00011303504124060822, 0.0003072610985834641, 0.0003072610985834641, 0.00011303504124060822, 0.00001529762932195991, 7.616241169186581e-7},
},
}
var weightsWithSigma32 = [][][]float64{
{
{0.013988327795128706, 0.014659641662554046, 0.015124988641639322, 0.01536317255514479, 0.01536317255514479, 0.015124988641639322, 0.014659641662554046, 0.013988327795128706},
{0.014659641662554046, 0.01536317255514479, 0.015850852002041782, 0.01610046660022062, 0.01610046660022062, 0.015850852002041782, 0.01536317255514479, 0.014659641662554046},
{0.015124988641639322, 0.015850852002041782, 0.01635401205635056, 0.016611550272437117, 0.016611550272437117, 0.01635401205635056, 0.015850852002041782, 0.015124988641639322},
{0.01536317255514479, 0.01610046660022062, 0.016611550272437117, 0.016873144125300537, 0.016873144125300537, 0.016611550272437117, 0.01610046660022062, 0.01536317255514479},
{0.01536317255514479, 0.01610046660022062, 0.016611550272437117, 0.016873144125300537, 0.016873144125300537, 0.016611550272437117, 0.01610046660022062, 0.01536317255514479},
{0.015124988641639322, 0.015850852002041782, 0.01635401205635056, 0.016611550272437117, 0.016611550272437117, 0.01635401205635056, 0.015850852002041782, 0.015124988641639322},
{0.014659641662554046, 0.01536317255514479, 0.015850852002041782, 0.01610046660022062, 0.01610046660022062, 0.015850852002041782, 0.01536317255514479, 0.014659641662554046},
{0.013988327795128706, 0.014659641662554046, 0.015124988641639322, 0.01536317255514479, 0.01536317255514479, 0.015124988641639322, 0.014659641662554046, 0.013988327795128706},
},
{
{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563},
},
{
{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.009111595985502156, 0.019289248852676043, 0.031802594879235035, 0.0408353401415612, 0.0408353401415612, 0.031802594879235035, 0.019289248852676043, 0.009111595985502156},
{0.007096118088539348, 0.0150224821113233, 0.024767885795650896, 0.031802594879235035, 0.031802594879235035, 0.024767885795650896, 0.0150224821113233, 0.007096118088539348},
{0.004304013185640522, 0.009111595985502156, 0.0150224821113233, 0.019289248852676043, 0.019289248852676043, 0.0150224821113233, 0.009111595985502156, 0.004304013185640522},
{0.002033071871452886, 0.004304013185640522, 0.007096118088539348, 0.009111595985502156, 0.009111595985502156, 0.007096118088539348, 0.004304013185640522, 0.002033071871452886},
},
}
var weightsWithSigma64 = [][][]float64{{{0.015202326218722117, 0.015381526429554142, 0.015502165236524684, 0.015562838995765221, 0.015562838995765221, 0.015502165236524684, 0.015381526429554142, 0.015202326218722117},
{0.015381526429554142, 0.015562838995765221, 0.015684899854817306, 0.015746288817132123, 0.015746288817132123, 0.015684899854817306, 0.015562838995765221, 0.015381526429554142},
{0.015502165236524684, 0.015684899854817306, 0.01580791804905204, 0.015869788490965698, 0.015869788490965698, 0.01580791804905204, 0.015684899854817306, 0.015502165236524684},
{0.015562838995765221, 0.015746288817132123, 0.015869788490965698, 0.01593190108694232, 0.01593190108694232, 0.015869788490965698, 0.015746288817132123, 0.015562838995765221},
{0.015562838995765221, 0.015746288817132123, 0.015869788490965698, 0.01593190108694232, 0.01593190108694232, 0.015869788490965698, 0.015746288817132123, 0.015562838995765221},
{0.015502165236524684, 0.015684899854817306, 0.01580791804905204, 0.015869788490965698, 0.015869788490965698, 0.01580791804905204, 0.015684899854817306, 0.015502165236524684},
{0.015381526429554142, 0.015562838995765221, 0.015684899854817306, 0.015746288817132123, 0.015746288817132123, 0.015684899854817306, 0.015562838995765221, 0.015381526429554142},
{0.015202326218722117, 0.015381526429554142, 0.015502165236524684, 0.015562838995765221, 0.015562838995765221, 0.015502165236524684, 0.015381526429554142, 0.015202326218722117}},
{{0.013988327795128706, 0.014659641662554046, 0.015124988641639322, 0.01536317255514479, 0.01536317255514479, 0.015124988641639322, 0.014659641662554046, 0.013988327795128706},
{0.014659641662554046, 0.01536317255514479, 0.015850852002041782, 0.01610046660022062, 0.01610046660022062, 0.015850852002041782, 0.01536317255514479, 0.014659641662554046},
{0.015124988641639322, 0.015850852002041782, 0.01635401205635056, 0.016611550272437117, 0.016611550272437117, 0.01635401205635056, 0.015850852002041782, 0.015124988641639322},
{0.01536317255514479, 0.01610046660022062, 0.016611550272437117, 0.016873144125300537, 0.016873144125300537, 0.016611550272437117, 0.01610046660022062, 0.01536317255514479},
{0.01536317255514479, 0.01610046660022062, 0.016611550272437117, 0.016873144125300537, 0.016873144125300537, 0.016611550272437117, 0.01610046660022062, 0.01536317255514479},
{0.015124988641639322, 0.015850852002041782, 0.01635401205635056, 0.016611550272437117, 0.016611550272437117, 0.01635401205635056, 0.015850852002041782, 0.015124988641639322},
{0.014659641662554046, 0.01536317255514479, 0.015850852002041782, 0.01610046660022062, 0.01610046660022062, 0.015850852002041782, 0.01536317255514479, 0.014659641662554046},
{0.013988327795128706, 0.014659641662554046, 0.015124988641639322, 0.01536317255514479, 0.01536317255514479, 0.015124988641639322, 0.014659641662554046, 0.013988327795128706}},
{{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.014387972682974322, 0.017355207878046373, 0.019666026959661444, 0.020934376727488848, 0.020934376727488848, 0.019666026959661444, 0.017355207878046373, 0.014387972682974322},
{0.013516249485789531, 0.016303708988480107, 0.018474522619547944, 0.019666026959661444, 0.019666026959661444, 0.018474522619547944, 0.016303708988480107, 0.013516249485789531},
{0.01192804830576989, 0.014387972682974322, 0.016303708988480107, 0.017355207878046373, 0.017355207878046373, 0.016303708988480107, 0.014387972682974322, 0.01192804830576989},
{0.00988869936854563, 0.01192804830576989, 0.013516249485789531, 0.014387972682974322, 0.014387972682974322, 0.013516249485789531, 0.01192804830576989, 0.00988869936854563}}}
// var weightsWithDistance = weightsWithSigma1
//var weightsWithDistance = weightsWithSigma2
//var weightsWithDistance = weightsWithSigma4
//var weightsWithDistance = weightsWithSigma4Same
//var weightsWithDistance = weightsWithSigma8
var weightsWithDistance = weightsWithSigma16
//var weightsWithDistance = weightsWithSigma32
//var weightsWithDistance = weightsWithSigma64
// calculateDistances 计算距离和权重距离
func calculateDistances(S, M, m int, sigma float64) ([][]float64, [][]float64) {
distances := make([][]float64, M*m)
weightedDistances := make([][]float64, M*m)
for i := range distances {
distances[i] = make([]float64, M*m)
weightedDistances[i] = make([]float64, M*m)
}
centerX := float64(S) / 2
centerY := float64(S) / 2
blockSize := float64(S) / float64(M*m)
center := Point{X: centerX, Y: centerY}
sum := 0.0
for i := 0; i < M*m; i++ {
for j := 0; j < M*m; j++ {
blockCenterX := (float64(j) + 0.5) * blockSize
blockCenterY := (float64(i) + 0.5) * blockSize
blockCenter := Point{X: blockCenterX, Y: blockCenterY}
distance := math.Sqrt(math.Pow(centerX-blockCenterX, 2) + math.Pow(centerY-blockCenterY, 2))
distances[i][j] = distance
weightedDistance := GaussianKernel2D(blockCenter, center, sigma)
weightedDistances[i][j] = weightedDistance
sum += weightedDistance
}
}
saveJson(fmt.Sprintf("tmp/ios/desc_distances_%d.json", S), distances)
for i := 0; i < M*m; i++ {
for j := 0; j < M*m; j++ {
weightedDistances[i][j] /= sum
}
}
saveJson(fmt.Sprintf("tmp/ios/desc_weighted_%d.json", S), weightedDistances)
return distances, weightedDistances
}
// 移动平均滤波器
type MovingAverage struct {
windowSize int
window [][][]float64
}
func NewMovingAverage(windowSize int) *MovingAverage {
return &MovingAverage{
windowSize: windowSize,
window: make([][][]float64, 0, windowSize),
}
}
func (ma *MovingAverage) AddFrame(frame [][]float64) {
if len(ma.window) == ma.windowSize {
ma.window = ma.window[1:]
}
ma.window = append(ma.window, frame)
}
func (ma *MovingAverage) GetAverage() [][]float64 {
if len(ma.window) == 0 {
return nil
}
height := len(ma.window[0])
width := len(ma.window[0][0])
average := make([][]float64, height)
for i := range average {
average[i] = make([]float64, width)
}
for _, frame := range ma.window {
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
average[y][x] += frame[y][x]
}
}
}
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
average[y][x] /= float64(len(ma.window))
}
}
return average
}