FUZZBOUND_BASE - Base function for FUZZBOUND.

Contents

Syntax

   fmap = FUZZBOUND_BASE(fmemb, thmax, thcon, thent);

See also

Ressembles: FUZZBOUND.

Function implementation

function fmap = fuzzbound_base(fmemb, thmax, thcon, thent)

setting internal variables

[X,Y,nC] = size(fmemb);
ind = 0:X*Y-1;

main calculation

% the process defining fuzzy boundaries can be done via a slicing
mfm = min(fmemb(:)); % should be 0

fmap = zeros(X,Y,3);
f = permute(reshape(fmemb,[X*Y nC]), [2 1]);
[~,i] = max(f,[],1);

get the maximum membership value

pmax = f(i+nC*ind);

store the max value in fmap, 1 component

fmap(:,:,1) = reshape(pmax, [X Y]);
if ~isempty(thmax) && thmax<1
    fmap(:,:,1) = fmap(:,:,1) <= thmax;
end
f(i+nC*ind) = mfm-eps; % set to the min
pmax2 = max(f,[],1);

fmap(:,:,2) = 1 - reshape(pmax - pmax2, [X Y]);
if ~isempty(thcon) && thcon<1
    fmap(:,:,2) = fmap(:,:,2)  <= thcon;
end
fmap(:,:,3) = - sum( fmemb .* log (fmemb) / log(2), 3);
if ~isempty(thcon) && thcon>0
    fmap(:,:,3) = fmap(:,:,3)  > thent;
end
end % end of fuzzbound_base