File: findWTLM.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (45 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [maxmap] = findWTLM(wt,scale,depth)

// function [maxmap] = findWTLM(wt,scale,depth)
// Finds the local modulus maxima of a continuous wavelet transform
//
// Intputs:
//	wt	continuous wavelet coefficients matrix
//		matrix of size [N_scale,N]
//	scale	scale vector [1,N_scale]
//	[depth]	maximum relative depth for the peaks search [scalar]
//		Default value is 1 (all found peaks) 
// Outputs:
//	maxmap	0/1 matrix (same size as cw) indicating weither the 
//		corresponding WT coefficient in wt is (1) or is not (0) a
//		local maxima
//		matrix of size [N_scale,N] 

[nargout,nargin] = argn(0) ;
if nargin == 2
  depth = 1 ;
elseif nargin == 3
  depth = min(1,depth) ;
end

n = size(wt,2) ;
s = size(wt,1) ;

maxmap = zeros(s,n) ; maxmap = (maxmap == 0) ;

x = 1:n ;
xplus = [x(2:n) x(1)] ; 
xminus = [x(n) x(1:n-1)] ;
wt = abs(wt) ;


for k = 1:s
  maxdepth = (1-depth) * max(wt(k,:)) 
  maxmap(k,x) = wt(k,x) > wt(k,xminus) & wt(k,x) > wt(k,xplus) & wt(k,x) >= maxdepth ;
end