Home > vbmeg > functions > common > morphology > vb_histmin_estimate.m

vb_histmin_estimate

PURPOSE ^

smoothing histgram and find first local minimum

SYNOPSIS ^

function [ix_min, ix_max, z] = vb_histmin_estimate(y,N)

DESCRIPTION ^

 smoothing histgram and find first local minimum
   [ix_min, ix_max, z] = vb_histmin_estimate(y)
   [ix_min, ix_max, z] = vb_histmin_estimate(y,N)
 y ; histgram
 N : smoothing width [ = 5 ]
 z : smoothing histgram
 ix_min : first local minimum point
 ix_max : max point in ix > ix_min

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ix_min, ix_max, z] = vb_histmin_estimate(y,N)
0002 % smoothing histgram and find first local minimum
0003 %   [ix_min, ix_max, z] = vb_histmin_estimate(y)
0004 %   [ix_min, ix_max, z] = vb_histmin_estimate(y,N)
0005 % y ; histgram
0006 % N : smoothing width [ = 5 ]
0007 % z : smoothing histgram
0008 % ix_min : first local minimum point
0009 % ix_max : max point in ix > ix_min
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 % N : smoothing width
0015 if nargin==1, N = 5; end;
0016 
0017 % Gaussian smoothing filter
0018 t = (1:N)/N;
0019 b = [fliplr(exp(-3*t.^2)), 1, exp(-3*t.^2)];
0020 b = b/sum(b);
0021 
0022 % plot(b); return
0023 
0024 % Gaussian smoothing of histgram
0025 a = 1;
0026 z = filter(b,a, [y zeros(1,N)]);
0027 
0028 z = z(N+1:end);
0029 
0030 % local minimum point of smoothing histgram
0031 ix = find( z(1:end-2) >= z(2:end-1) ...
0032          & z(2:end-1) <= z(3:end));
0033 
0034 % first local minimum point
0035 ix_min = ix(1);
0036 
0037 % max point in ix > ix_min
0038 [zmax, ix_max] = max(z(ix_min:end));
0039 ix_max = ix_max(1) + ix_min - 1;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005