Mercurial > hg > emotion-detection-top-level
diff Code/Descriptors/Matlab/MPEG7/FromWeb/mpeg7getspec.m @ 4:92ca03a8fa99 tip
Update to ICASSP 2013 benchmark
author | Dawn Black |
---|---|
date | Wed, 13 Feb 2013 11:02:39 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Code/Descriptors/Matlab/MPEG7/FromWeb/mpeg7getspec.m Wed Feb 13 11:02:39 2013 +0000 @@ -0,0 +1,27 @@ +% Modified 30/04/2002 by Thorsten Kastner - zero pad (length overlap) at start and end for overlap removed; +% because: there's no overlap in ASF +function [fftout,phase] = mpeg7getspec( data, fs, hopsize, windowsize, window, FFTsize) +% data = data(1:5004); +if size(data,1)==1 + data = data'; +end + +hs = mean(hopsize); +hops = length(hopsize); +num_f = ceil(length(data)/hs); +rem_f = mod(num_f,hops); +pad = sum(hopsize(1:rem_f)) - (length(data)-(num_f-rem_f)*hs); +data = [data; zeros(pad,1)]; +num_samples = length(data); +fstart = 1; +fftout = []; +NormWindow = sum(window.*window); +spec = (h_specgram2(data,FFTsize,fs,window,hopsize))/sqrt(FFTsize*NormWindow); +fftout = abs(spec); +phase = angle(spec); +% figure(30); imagesc([1 size(fftout(2))],[0 v.fs/2],fftout) +% Need to compensate first and last frames for the zero padding + +if pad + fftout(:,end) = fftout(:,end)*sqrt(windowsize/(windowsize-pad)); +end \ No newline at end of file