annotate toolboxes/AudioInpaintingToolbox/Utils/dictionaries/Gabor_Dictionary.m @ 239:71128ec3e532 ver_2.0_beta

added documentation file/folder
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 25 Apr 2012 13:06:28 +0100
parents 56d719a5fd31
children
rev   line source
ivan@138 1 function D = Gabor_Dictionary(param)
ivan@138 2 % Windowed Gabor dictionary. In this implementation, the dictionary matrix
ivan@138 3 % is the concatenation of a DCT (left part of the matrix) and of a DST
ivan@138 4 % (right part).
ivan@138 5 % Note that one can use this dictionary
ivan@138 6 % - either by constraining the simulaneous selection of cosine and sine
ivan@138 7 % atoms with same frequency in order to implement Gabor atoms;
ivan@138 8 % - or, without any selection constraint, by considering that the
ivan@138 9 % dictionary is not a Gabor dictionary but the concatenation of a DCT and
ivan@138 10 % of a DST.
ivan@138 11 %
ivan@138 12 % Usage:
ivan@138 13 % D = Gabor_Dictionary(param)
ivan@138 14 %
ivan@138 15 % Inputs [and default values]:
ivan@138 16 % - param.N: frame length [256]
ivan@138 17 % - param.redundancyFactor: redundancy factor to adjust the number of
ivan@138 18 % frequencies [1]. The number of atoms in the dictionary equals
ivan@138 19 % param.N*param.redundancyFactor
ivan@138 20 % - param.wd: weigthing window function [@wSine]
ivan@138 21 %
ivan@138 22 % Output:
ivan@138 23 % - Dictionary: D (cosine atoms followed by sine atoms)
ivan@138 24 %
ivan@138 25 %
ivan@138 26 % -------------------
ivan@138 27 %
ivan@138 28 % Audio Inpainting toolbox
ivan@138 29 % Date: June 28, 2011
ivan@138 30 % By Valentin Emiya, Amir Adler, Maria Jafari
ivan@138 31 % This code is distributed under the terms of the GNU Public License version 3 (http://www.gnu.org/licenses/gpl.txt).
ivan@138 32
ivan@138 33 % Check and load default parameters
ivan@138 34 defaultParam.N = 256;
ivan@138 35 defaultParam.redundancyFactor = 1;
ivan@138 36 defaultParam.wd = @wSine;
ivan@138 37
ivan@138 38 if nargin<1
ivan@138 39 param = defaultParam;
ivan@138 40 else
ivan@138 41 names = fieldnames(defaultParam);
ivan@138 42 for k=1:length(names)
ivan@138 43 if ~isfield(param,names{k}) || isempty(param.(names{k}))
ivan@138 44 param.(names{k}) = defaultParam.(names{k});
ivan@138 45 end
ivan@138 46 end
ivan@138 47 end
ivan@138 48 K = param.N*param.redundancyFactor; % number of atoms
ivan@138 49 wd = param.wd(param.N); % weigthing window
ivan@138 50 u = 0:(param.N-1); % time
ivan@138 51 k=0:K/2-1; % frequency
ivan@138 52 D = diag(wd)*[cos(2*pi/K*(u.'+1/2)*(k+1/2)),sin(2*pi/K*(u.'+1/2)*(k+1/2))];
ivan@138 53
ivan@138 54 % normalisation
ivan@138 55 D = D*diag(1./sqrt(diag(D'*D)));
ivan@138 56
ivan@138 57 return