markpseudoblob.m

来自「A demo for image segmentation using iter」· M 代码 · 共 23 行

M
23
字号
function Lout = MarkPseudoBlob( L, bwridge, NUMTHRESH, MERGETHRESH )

%% Mark those unqualified blob as -1
LABELNUM = max(L(:));
Metrics = ones([1, LABELNUM ]);
for i = 1:LABELNUM
    blob = (L==i);
    xt = sum(blob(:));
    if( xt>0 )
        blobperim = bwperim(blob); %perimeter
        xt = sum(sum(bwridge&blobperim)); %ridge in the perimeter
        yt = sum(sum(blobperim));
        Metrics(i) = xt/yt;
    end
end
[sval, sid] = sort(Metrics);

Lout = L;
for i = 1:NUMTHRESH
    if( sval(i)<MERGETHRESH )
        Lout(L==sid(i)) = -1;
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?