annotate dsp/wignerdata.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
c3b0cd708782 |
children |
|
rev |
line source |
samer@32
|
1 function Z=wignerdata(m,X)
|
samer@32
|
2 % sliding window wigner distribution. feature:
|
samer@32
|
3 % - low pass filter because of undersampling of
|
samer@32
|
4 % autocorrelation function
|
samer@32
|
5 % - windowing of autocorrelation to avoid spectral leakage
|
samer@32
|
6 % - temporal smoothing followed by down sampling
|
samer@32
|
7
|
samer@32
|
8 N = 2*m+1; % frame size
|
samer@32
|
9
|
samer@32
|
10 [ filtB, filtA ] = butter( 5, 0.5);
|
samer@32
|
11
|
samer@32
|
12 % make sure frames are N samples long
|
samer@32
|
13
|
samer@32
|
14 % lowpass signal, get autocorrelation in wigner form,
|
samer@32
|
15 % then short term average (exponential window) by 1st
|
samer@32
|
16 % order IIR.
|
samer@32
|
17 Im=m+1:2*m+1;
|
samer@32
|
18 Ip=m+1:-1:1;
|
samer@32
|
19 Z=map(@wiglocal,select(filtA,filtB,X));
|
samer@32
|
20
|
samer@32
|
21 function z=wiglocal(m,Im,Ip,X)
|
samer@32
|
22 r=X(Ip,:).*X(Im,:);
|
samer@32
|
23 %smoothing??
|
samer@32
|
24 smKernel = gauss_win(128,0.4)';
|
samer@32
|
25 wigR = spdiag(hgauss_win(m,0.5))*r;
|
samer@32
|
26 % must filter and subsample wigR here
|
samer@32
|
27 smRS = filter2(smKernel, wigR, 'valid');
|
samer@32
|
28 % subsample in time here?
|
samer@32
|
29
|
samer@32
|
30 % take real fft using window
|
samer@32
|
31 z = abs(fft([smR(1:m,:); smR(m+1:-1:2,:)]));
|
samer@32
|
32 end
|
samer@32
|
33 end
|
samer@32
|
34
|
samer@32
|
35
|
samer@32
|
36
|
samer@32
|
37
|