]> AND Private Git Repository - these_gilles.git/blob - THESE/codes/meanshift/Ms_segmenter/Gravitat.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
20 déc
[these_gilles.git] / THESE / codes / meanshift / Ms_segmenter / Gravitat.m
1 function Gravit = Gravitat(Gray_image)\r
2 % finds out forces acting on pixels from other pixels\r
3 [Rows, Cols] = size(Gray_image);\r
4 Gray_image = double(Gray_image);\r
5 \r
6 % creating the filter\r
7 Wind = 3;\r
8 for i=1:2*Wind-1\r
9    for j=1:2*Wind-1\r
10       Filter(i, j) = exp(-abs(Wind-i) - abs(Wind-j));\r
11    end\r
12 end\r
13 Filter(Wind, Wind) = 0;\r
14 \r
15 Gravit = zeros(size(Gray_image(Wind:Rows-Wind+1, Wind:Cols-Wind+1)));\r
16 for i=1:2*Wind-1\r
17    for j=1:2*Wind-1\r
18       Gravit = Gravit + Filter(i, j) * ...\r
19          exp(-abs(Gray_image(Wind:Rows-Wind+1, Wind:Cols-Wind+1) - ...\r
20          Gray_image(i:Rows-Wind+1+i-Wind, j:Cols-Wind+1+j-Wind)));\r
21    end\r
22 end