File: gen_qbgn.m

package info (click to toggle)
python-dtcwt 0.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,588 kB
  • sloc: python: 6,287; sh: 29; makefile: 13
file content (31 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% gen_qbgn.m
% Generate and display a 3-D fruitcake-like volume.
%
% Nick Kingsbury, Cambridge University, Nov 2011.
function bg=gen_qbgn(N,F,seed)
    if nargin<3
        seed=0;
    end    
    Q=4;
    h = gaussian(3,0.01);
    h = gaussian(1.5,0.01);
    h = gaussian(8,0.01);
    y = zeros(N,N,F);
    RandStream.setGlobalStream(RandStream('mt19937ar', 'seed', seed));
    for f=1:F,
        x=randn(N,N);
        
        y(:,:,f) = colfilter(colfilter(x,h).',h).';
    end
    for k=1:N,
        y(k,:,:) = colfilter(squeeze(y(k,:,:)).',h).';
    end
    yvar = var(y(:));
    y = y*(16/sqrt(yvar)) + 128;  
    t1=ceil(min(y(:)));
    t2=floor(max(y(:)));

    step=(t2-t1)/50;
    z = double(softquant(y,[t1 t2 step]));
    bg=z;
end