]> AND Private Git Repository - these_gilles.git/blob - THESE/codes/bm3D/BM3D/BM3D-SAPCA/function_CreateLPAKernels.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
07 sep
[these_gilles.git] / THESE / codes / bm3D / BM3D / BM3D-SAPCA / function_CreateLPAKernels.m
1 % Creates LPA kernels cell array    (function_CreateLPAKernels)\r
2 %\r
3 % Alessandro Foi - Tampere University of Technology - 2003-2005\r
4 % ---------------------------------------------------------------\r
5 %\r
6 %  Builds kernels cell arrays kernels{direction,size}\r
7 %                  and        kernels_higher_order{direction,size,1:2}\r
8 %               kernels_higher_order{direction,size,1}  is the 3D matrix\r
9 %                   of all kernels for that particular direction/size\r
10 %               kernels_higher_order{direction,size,2}  is the 2D matrix\r
11 %                   containing the orders indices for the kernels\r
12 %                   contained in kernels_higher_order{direction,size,1}\r
13 %\r
14 %   ---------------------------------------------------------------------\r
15\r
16 %   kernels_higher_order{direction,size,1}(:,:,1) is the funcion estimate kernel\r
17 %   kernels_higher_order{direction,size,1}(:,:,2) is a first derivative estimate kernel\r
18 %\r
19 %   kernels_higher_order{direction,size,1}(:,:,n) is a higher order derivative estimate kernel\r
20 %   whose orders with respect to x and y are specified in\r
21 %   kernels_higher_order{direction,size,2}(n,:)=\r
22 %                           =[xorder yorder xorder+yorder]\r
23 %   \r
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
25 \r
26 function [kernels, kernels_higher_order]=function_createLPAkernels(m,h1,h2,TYPE,window_type,directional_resolution,sig_winds,beta)\r
27 \r
28 %--------------------------------------------------------------------------\r
29 % LPA ORDER AND KERNELS SIZES\r
30 %--------------------------------------------------------------------------\r
31 %    m=[2,0];        % THE VECTOR ORDER OF LPA;\r
32 \r
33 %    h1=[1 2 3 4 5];    %   sizes of the kernel\r
34 %    h2=[1 2 3 4 5];    %   row vectors h1 and h2 need to have the same lenght\r
35 \r
36 \r
37 %--------------------------------------------------------------------------\r
38 % WINDOWS PARAMETERS\r
39 %--------------------------------------------------------------------------\r
40 %    sig_winds=[h1*1 ; h1*1];    % Gaussian parameter\r
41 %    beta=1;                     % Parameter of window 6\r
42 \r
43 %    window_type=1 ;  % window_type=1 for uniform, window_type=2 for Gaussian\r
44 % window_type=6 for exponentions with beta\r
45 % window_type=8 for Interpolation\r
46 \r
47 %    TYPE=00;        % TYPE IS A SYMMETRY OF THE WINDOW\r
48                      % 00 SYMMETRIC\r
49                      % 10 NONSYMMETRIC ON X1 and SYMMETRIC ON X2\r
50                      % 11 NONSYMMETRIC ON X1,X2  (Quadrants)\r
51                      % \r
52                      % for rotated directional kernels the method that is used for rotation can be specified by adding \r
53                      % a binary digit in front of these types, as follows:\r
54                      % \r
55                      % 10 \r
56                      % 11  ARE "STANDARD" USING NN (Nearest Neighb.) (you can think of these numbers with a 0 in front)\r
57                      % 00\r
58                      % \r
59                      % 110\r
60                      % 111  ARE EXACT SAMPLING OF THE EXACT ROTATED KERNEL\r
61                      % 100\r
62                      % \r
63                      % 210\r
64                      % 211  ARE WITH BILINEAR INTERP\r
65                      % 200\r
66                      % \r
67                      % 310\r
68                      % 311  ARE WITH BICUBIC INTERP (not reccomended)\r
69                      % 300\r
70 \r
71 %--------------------------------------------------------------------------\r
72 % DIRECTIONAL PARAMETERS\r
73 %--------------------------------------------------------------------------\r
74 %    directional_resolution=4;       % number of directions\r
75 \r
76 \r
77 \r
78 \r
79 \r
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
84 %%%%% From this point onwards this file and the create_LPA_kernels.m should be identical %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
86 \r
87 \r
88 \r
89 \r
90 \r
91 \r
92 \r
93 \r
94 \r
95 lenh=max(length(h1),length(h2));\r
96 clear kernels\r
97 clear kernels_higher_order\r
98 kernels=cell(directional_resolution,lenh);\r
99 kernels_higher_order=cell(directional_resolution,lenh,2);\r
100 THETASTEP=2*pi/directional_resolution;\r
101 THETA=[0:THETASTEP:2*pi-THETASTEP];\r
102 \r
103 \r
104 s1=0;\r
105 for theta=THETA,\r
106     s1=s1+1;\r
107     for s=1:lenh,\r
108         \r
109         \r
110         [gh,gh1,gh1degrees]=function_LPAKernelMatrixTheta(ceil(h2(s)),ceil(h1(s)),window_type,[sig_winds(1,s) sig_winds(2,s)],TYPE,theta, m);\r
111         kernels{s1,s}=gh;                          % degree=0 kernel\r
112         kernels_higher_order{s1,s,1}=gh1;          % degree>=0 kernels\r
113         kernels_higher_order{s1,s,2}=gh1degrees;   % polynomial indexes matrix\r
114        \r
115 end   % different lengths loop\r
116 end   % different directions loop\r
117 \r