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.m 4809 2015-03-29 11:55:10Z bgrychtol-ipa $
0009 
0010 sz = size(img);
0011 [x,y]=meshgrid(linspace(-1,1,sz(1)),linspace(-1,1,sz(2))); 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 Fri 30-Dec-2022 19:44:54 by m2html © 2005