calc_hm_set

PURPOSE ^

hm_img= CALC_HA_SET(img)

SYNOPSIS ^

function hm_img = calc_hm_set(img,frac)

DESCRIPTION ^

 hm_img= CALC_HA_SET(img)
 hm_img is szxszxNimg. It is 1 inside the Half Ampl Set
 frac is the fraction of maximum (0.5 or 0.25)
 hm_img expects conductive changes. Use calc_hm_set(-img,frac) for non-c

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function hm_img = calc_hm_set(img,frac)
0002 % hm_img= CALC_HA_SET(img)
0003 % hm_img is szxszxNimg. It is 1 inside the Half Ampl Set
0004 % frac is the fraction of maximum (0.5 or 0.25)
0005 % hm_img expects conductive changes. Use calc_hm_set(-img,frac) for non-c
0006 
0007 % (C) 2008 Andy Adler. Licenced under GPL v2 or v3
0008 % $Id: calc_hm_set.html 2819 2011-09-07 16:43:11Z aadler $
0009 
0010 sz = size(img,1);
0011 [x,y]=meshgrid(linspace(-1,1,sz),linspace(-1,1,sz)); map = x.^2+y.^2<1.1;
0012 
0013 hm_img = logical(zeros(size(img)));
0014 for i=1:size(img,3);
0015    imi = img(:,:,i); imi= imi(map);
0016 
0017    hmi= logical(zeros(sz));
0018    hmi(map) = imi >= (max(imi) * frac);
0019    hm_img(:,:,i) = hmi;
0020 end

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005