Mercurial > hg > emotion-detection-top-level
comparison 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 |
comparison
equal
deleted
inserted
replaced
3:e1cfa7765647 | 4:92ca03a8fa99 |
---|---|
1 % Modified 30/04/2002 by Thorsten Kastner - zero pad (length overlap) at start and end for overlap removed; | |
2 % because: there's no overlap in ASF | |
3 function [fftout,phase] = mpeg7getspec( data, fs, hopsize, windowsize, window, FFTsize) | |
4 % data = data(1:5004); | |
5 if size(data,1)==1 | |
6 data = data'; | |
7 end | |
8 | |
9 hs = mean(hopsize); | |
10 hops = length(hopsize); | |
11 num_f = ceil(length(data)/hs); | |
12 rem_f = mod(num_f,hops); | |
13 pad = sum(hopsize(1:rem_f)) - (length(data)-(num_f-rem_f)*hs); | |
14 data = [data; zeros(pad,1)]; | |
15 num_samples = length(data); | |
16 fstart = 1; | |
17 fftout = []; | |
18 NormWindow = sum(window.*window); | |
19 spec = (h_specgram2(data,FFTsize,fs,window,hopsize))/sqrt(FFTsize*NormWindow); | |
20 fftout = abs(spec); | |
21 phase = angle(spec); | |
22 % figure(30); imagesc([1 size(fftout(2))],[0 v.fs/2],fftout) | |
23 % Need to compensate first and last frames for the zero padding | |
24 | |
25 if pad | |
26 fftout(:,end) = fftout(:,end)*sqrt(windowsize/(windowsize-pad)); | |
27 end |