1 % Creates LPA kernels cell array (function_CreateLPAKernels)
\r
3 % Alessandro Foi - Tampere University of Technology - 2003-2005
\r
4 % ---------------------------------------------------------------
\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
14 % ---------------------------------------------------------------------
\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
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
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\r
26 function [kernels, kernels_higher_order]=function_createLPAkernels(m,h1,h2,TYPE,window_type,directional_resolution,sig_winds,beta)
\r
28 %--------------------------------------------------------------------------
\r
29 % LPA ORDER AND KERNELS SIZES
\r
30 %--------------------------------------------------------------------------
\r
31 % m=[2,0]; % THE VECTOR ORDER OF LPA;
\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
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
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
47 % TYPE=00; % TYPE IS A SYMMETRY OF THE WINDOW
\r
49 % 10 NONSYMMETRIC ON X1 and SYMMETRIC ON X2
\r
50 % 11 NONSYMMETRIC ON X1,X2 (Quadrants)
\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
56 % 11 ARE "STANDARD" USING NN (Nearest Neighb.) (you can think of these numbers with a 0 in front)
\r
60 % 111 ARE EXACT SAMPLING OF THE EXACT ROTATED KERNEL
\r
64 % 211 ARE WITH BILINEAR INTERP
\r
68 % 311 ARE WITH BICUBIC INTERP (not reccomended)
\r
71 %--------------------------------------------------------------------------
\r
72 % DIRECTIONAL PARAMETERS
\r
73 %--------------------------------------------------------------------------
\r
74 % directional_resolution=4; % number of directions
\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
95 lenh=max(length(h1),length(h2));
\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
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
115 end % different lengths loop
\r
116 end % different directions loop
\r