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

Private GIT Repository
19 sept
[these_gilles.git] / THESE / codes / meanshift / Ms_segmenter / Smooth_wv.m
1 function Smoothed = Smooth_wv(G_image)\r\r
2 [Low, High, Low_i, High_i] = symlets(12);\r\r
3 \r\r
4 [Rows, Cols] = size(G_image);\r\r
5 Log_size = floor(log2(max(Rows, Cols)));\r\r
6 New_size = 2^Log_size;\r\r
7 Resized = imresize(G_image, [New_size, New_size], 'bilinear');\r\r
8 \r\r
9 Forward = wt2d(Resized, Low, High, Log_size);\r\r
10 Forward_r = -abs(reshape(Forward, 1, New_size*New_size));\r\r
11 Forward_s = sort(Forward_r);\r\r
12 Cutoff = -Forward_s(floor(New_size*New_size*0.1));              % taking 10%\r\r
13 To_take = abs(Forward) > Cutoff;\r\r
14 Forward = Forward .* To_take;\r\r
15 \r\r
16 % Forward(New_size/2+1:New_size, :) = ...\r\r
17 %   zeros(size(Forward(New_size/2+1:New_size, :)));\r\r
18 % Forward(:, New_size/2+1:New_size) = ...\r\r
19 %     zeros(size(Forward(:, New_size/2+1:New_size)));\r\r
20 Smoothed = iwt2d(Forward, Low_i, High_i, Log_size, New_size, New_size);\r\r
21 Smoothed = imresize(Smoothed, [Rows, Cols], 'bilinear');\r\r
22 Smoothed = Smoothed .* (Smoothed >= 0);