function [u_out,ef,s,tmbs,lambda_n] = signature_full_n(u_in,scale,l_0,l_n); % input: % u_in: 8 bit binary image % scale: number of steps from lambda_0 to lambda_n (optional) % l_0, l_n: normalized lambda ranges from l_0 to l_n (optional) % % output: % u_out: list of scale images, one for each normalized lambda value % ef: full signature % s: S-signature % tmbs: 1-d measure of T-\boundary(S) for each lambda % lambda_n: list of normalized lambda values if ~exist('scale','var'); fprintf('[warn] Scale unset -- using scale == 50.\n'); scale = 50; end if ~exist('l_0','var') || ~exist('l_n','var'); fprintf('[warn] l_0 or l_n unset -- using 1 and 50.\n'); l_0 = 1; l_n = 50; end; area_n = sum(sum(u_in./max(max(u_in)))); lambda_n = l_n + (l_0 - l_n) * ((1:scale)./scale); % from FNS paper, want area of (n_scale * object) = 1 n_scale = sqrt(1/area_n); [N,M] = size(u_in); % u_in should be 8 bit binary image u_out=zeros(scale,N,M); %S = max(N,M); % use this to set scales nNeighbors = 16; % we use 16 neighbors for i = 1:scale; u_out(i,:,:) = Graph_anisoTV_L1_v2(u_in,lambda_n(i)*n_scale,nNeighbors,2); % do not change the last input argument [e,s,t] = energy_full(squeeze(u_out(i,:,:)),u_in,lambda_n(i)*n_scale); output(i,:) = [e,s,t]/255; end ef = output(:,1); s = output(:,2); tmbs = output(:,3);