annotate util/Rice Wavelet Toolbox/makesig.m @ 119:5356a6e13a25 sup_163_ssim_IMG_T_dependeny

New version of ssim index - IMP toolbox dependencies removed
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Tue, 24 May 2011 16:16:36 +0100
parents f69ae88b8be5
children
rev   line source
ivan@78 1 function [x,N] = makesig(SigName,N)
ivan@78 2 % [x,N] = makesig(SigName,N) Creates artificial test signal identical to the
ivan@78 3 % standard test signals proposed and used by D. Donoho and I. Johnstone
ivan@78 4 % in WaveLab (- a matlab toolbox developed by Donoho et al. the statistics
ivan@78 5 % department at Stanford University).
ivan@78 6 %
ivan@78 7 % Input: SigName - Name of the desired signal (Default 'all')
ivan@78 8 % 'AllSig' (Returns a matrix with all the signals)
ivan@78 9 % 'HeaviSine'
ivan@78 10 % 'Bumps'
ivan@78 11 % 'Blocks'
ivan@78 12 % 'Doppler'
ivan@78 13 % 'Ramp'
ivan@78 14 % 'Cusp'
ivan@78 15 % 'Sing'
ivan@78 16 % 'HiSine'
ivan@78 17 % 'LoSine'
ivan@78 18 % 'LinChirp'
ivan@78 19 % 'TwoChirp'
ivan@78 20 % 'QuadChirp'
ivan@78 21 % 'MishMash'
ivan@78 22 % 'Werner Sorrows' (Heisenberg)
ivan@78 23 % 'Leopold' (Kronecker)
ivan@78 24 % N - Length in samples of the desired signal (Default 512)
ivan@78 25 %
ivan@78 26 % Output: x - vector/matrix of test signals
ivan@78 27 % N - length of signal returned
ivan@78 28 %
ivan@78 29 % See also:
ivan@78 30 %
ivan@78 31 % References:
ivan@78 32 % WaveLab can be accessed at
ivan@78 33 % www_url: http://playfair.stanford.edu/~wavelab/
ivan@78 34 % Also see various articles by D.L. Donoho et al. at
ivan@78 35 % web_url: http://playfair.stanford.edu/
ivan@78 36
ivan@78 37 %File Name: makesig.m
ivan@78 38 %Last Modification Date: 08/30/95 15:52:03
ivan@78 39 %Current Version: makesig.m 2.4
ivan@78 40 %File Creation Date: Thu Jun 8 10:31:11 1995
ivan@78 41 %Author: Jan Erik Odegard <odegard@ece.rice.edu>
ivan@78 42 %
ivan@78 43 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
ivan@78 44 %Created by Jan Erik Odegard, Department of ECE, Rice University.
ivan@78 45 %
ivan@78 46 %This software is distributed and licensed to you on a non-exclusive
ivan@78 47 %basis, free-of-charge. Redistribution and use in source and binary forms,
ivan@78 48 %with or without modification, are permitted provided that the following
ivan@78 49 %conditions are met:
ivan@78 50 %
ivan@78 51 %1. Redistribution of source code must retain the above copyright notice,
ivan@78 52 % this list of conditions and the following disclaimer.
ivan@78 53 %2. Redistribution in binary form must reproduce the above copyright notice,
ivan@78 54 % this list of conditions and the following disclaimer in the
ivan@78 55 % documentation and/or other materials provided with the distribution.
ivan@78 56 %3. All advertising materials mentioning features or use of this software
ivan@78 57 % must display the following acknowledgment: This product includes
ivan@78 58 % software developed by Rice University, Houston, Texas and its contributors.
ivan@78 59 %4. Neither the name of the University nor the names of its contributors
ivan@78 60 % may be used to endorse or promote products derived from this software
ivan@78 61 % without specific prior written permission.
ivan@78 62 %
ivan@78 63 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS,
ivan@78 64 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
ivan@78 65 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
ivan@78 66 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY
ivan@78 67 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
ivan@78 68 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
ivan@78 69 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
ivan@78 70 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
ivan@78 71 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
ivan@78 72 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE
ivan@78 73 %USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ivan@78 74 %
ivan@78 75 %For information on commercial licenses, contact Rice University's Office of
ivan@78 76 %Technology Transfer at techtran@rice.edu or (713) 348-6173
ivan@78 77 %
ivan@78 78 %Change History: This m-file is a copy of the code provided with WaveLab
ivan@78 79 % customized to be consistent with RWT.
ivan@78 80 % Jan Erik Odegard <odegard@ece.rice.edu> Thu Jun 8 1995
ivan@78 81 %
ivan@78 82
ivan@78 83 if(nargin < 1)
ivan@78 84 SigName = 'AllSig';
ivan@78 85 N = 512;
ivan@78 86 elseif(nargin == 1)
ivan@78 87 N = 512;
ivan@78 88 end;
ivan@78 89 t = (1:N) ./N;
ivan@78 90 x = [];
ivan@78 91 y = [];
ivan@78 92 if(strcmp(SigName,'HeaviSine') | strcmp(SigName,'AllSig')),
ivan@78 93 y = 4.*sin(4*pi.*t);
ivan@78 94 y = y - sign(t - .3) - sign(.72 - t);
ivan@78 95 end;
ivan@78 96 x = [x;y];
ivan@78 97 y = [];
ivan@78 98 if(strcmp(SigName,'Bumps') | strcmp(SigName,'AllSig')),
ivan@78 99 pos = [ .1 .13 .15 .23 .25 .40 .44 .65 .76 .78 .81];
ivan@78 100 hgt = [ 4 5 3 4 5 4.2 2.1 4.3 3.1 5.1 4.2];
ivan@78 101 wth = [.005 .005 .006 .01 .01 .03 .01 .01 .005 .008 .005];
ivan@78 102 y = zeros(size(t));
ivan@78 103 for j =1:length(pos)
ivan@78 104 y = y + hgt(j)./( 1 + abs((t - pos(j))./wth(j))).^4;
ivan@78 105 end
ivan@78 106 end;
ivan@78 107 x = [x;y];
ivan@78 108 y = [];
ivan@78 109 if(strcmp(SigName,'Blocks') | strcmp(SigName,'AllSig')),
ivan@78 110 pos = [ .1 .13 .15 .23 .25 .40 .44 .65 .76 .78 .81];
ivan@78 111 hgt = [4 (-5) 3 (-4) 5 (-4.2) 2.1 4.3 (-3.1) 2.1 (-4.2)];
ivan@78 112 y = zeros(size(t));
ivan@78 113 for j=1:length(pos)
ivan@78 114 y = y + (1 + sign(t-pos(j))).*(hgt(j)/2) ;
ivan@78 115 end
ivan@78 116 end;
ivan@78 117 x = [x;y];
ivan@78 118 y = [];
ivan@78 119 if(strcmp(SigName,'Doppler') | strcmp(SigName,'AllSig')),
ivan@78 120 y = sqrt(t.*(1-t)).*sin((2*pi*1.05) ./(t+.05));
ivan@78 121 end;
ivan@78 122 x = [x;y];
ivan@78 123 y = [];
ivan@78 124 if(strcmp(SigName,'Ramp') | strcmp(SigName,'AllSig')),
ivan@78 125 y = t - (t >= .37);
ivan@78 126 end;
ivan@78 127 x = [x;y];
ivan@78 128 y = [];
ivan@78 129 if(strcmp(SigName,'Cusp') | strcmp(SigName,'AllSig')),
ivan@78 130 y = sqrt(abs(t - .37));
ivan@78 131 end;
ivan@78 132 x = [x;y];
ivan@78 133 y = [];
ivan@78 134 if(strcmp(SigName,'Sing') | strcmp(SigName,'AllSig')),
ivan@78 135 k = floor(N * .37);
ivan@78 136 y = 1 ./abs(t - (k+.5)/N);
ivan@78 137 end;
ivan@78 138 x = [x;y];
ivan@78 139 y = [];
ivan@78 140 if(strcmp(SigName,'HiSine') | strcmp(SigName,'AllSig')),
ivan@78 141 y = sin( pi * (N * .6902) .* t);
ivan@78 142 end;
ivan@78 143 x = [x;y];
ivan@78 144 y = [];
ivan@78 145 if(strcmp(SigName,'LoSine') | strcmp(SigName,'AllSig')),
ivan@78 146 y = sin( pi * (N * .3333) .* t);
ivan@78 147 end;
ivan@78 148 x = [x;y];
ivan@78 149 y = [];
ivan@78 150 if(strcmp(SigName,'LinChirp') | strcmp(SigName,'AllSig')),
ivan@78 151 y = sin(pi .* t .* ((N .* .125) .* t));
ivan@78 152 end;
ivan@78 153 x = [x;y];
ivan@78 154 y = [];
ivan@78 155 if(strcmp(SigName,'TwoChirp') | strcmp(SigName,'AllSig')),
ivan@78 156 y = sin(pi .* t .* (N .* t)) + sin((pi/3) .* t .* (N .* t));
ivan@78 157 end;
ivan@78 158 x = [x;y];
ivan@78 159 y = [];
ivan@78 160 if(strcmp(SigName,'QuadChirp') | strcmp(SigName,'AllSig')),
ivan@78 161 y = sin( (pi/3) .* t .* (N .* t.^2));
ivan@78 162 end;
ivan@78 163 x = [x;y];
ivan@78 164 y = [];
ivan@78 165 if(strcmp(SigName,'MishMash') | strcmp(SigName,'AllSig')),
ivan@78 166 % QuadChirp + LinChirp + HiSine
ivan@78 167 y = sin( (pi/3) .* t .* (N .* t.^2)) ;
ivan@78 168 y = y + sin( pi * (N * .6902) .* t);
ivan@78 169 y = y + sin(pi .* t .* (N .* .125 .* t));
ivan@78 170 end;
ivan@78 171 x = [x;y];
ivan@78 172 y = [];
ivan@78 173 if(strcmp(SigName,'WernerSorrows') | strcmp(SigName,'AllSig')),
ivan@78 174 y = sin( pi .* t .* (N/2 .* t.^2)) ;
ivan@78 175 y = y + sin( pi * (N * .6902) .* t);
ivan@78 176 y = y + sin(pi .* t .* (N .* t));
ivan@78 177 pos = [ .1 .13 .15 .23 .25 .40 .44 .65 .76 .78 .81];
ivan@78 178 hgt = [ 4 5 3 4 5 4.2 2.1 4.3 3.1 5.1 4.2];
ivan@78 179 wth = [.005 .005 .006 .01 .01 .03 .01 .01 .005 .008 .005];
ivan@78 180 for j =1:length(pos)
ivan@78 181 y = y + hgt(j)./( 1 + abs((t - pos(j))./wth(j))).^4;
ivan@78 182 end
ivan@78 183 end;
ivan@78 184 x = [x;y];
ivan@78 185 y = [];
ivan@78 186 if(strcmp(SigName,'Leopold') | strcmp(SigName,'AllSig')),
ivan@78 187 y = (t == floor(.37 * N)/N); % Kronecker
ivan@78 188 end;
ivan@78 189 x = [x;y];
ivan@78 190 y = [];
ivan@78 191
ivan@78 192 % disp(sprintf('MakeSignal: I don*t recognize << %s>>',SigName))
ivan@78 193 % disp('Allowable SigNames are:')
ivan@78 194 % disp('AllSig'),
ivan@78 195 % disp('HeaviSine'),
ivan@78 196 % disp('Bumps'),
ivan@78 197 % disp('Blocks'),
ivan@78 198 % disp('Doppler'),
ivan@78 199 % disp('Ramp'),
ivan@78 200 % disp('Cusp'),
ivan@78 201 % disp('Crease'),
ivan@78 202 % disp('Sing'),
ivan@78 203 % disp('HiSine'),
ivan@78 204 % disp('LoSine'),
ivan@78 205 % disp('LinChirp'),
ivan@78 206 % disp('TwoChirp'),
ivan@78 207 % disp('QuadChirp'),
ivan@78 208 % disp('MishMash'),
ivan@78 209 % disp('WernerSorrows'),
ivan@78 210 % disp('Leopold'),
ivan@78 211 %end