lhiobjectpolygon.m

来自「This code can parse any image in matlab.」· M 代码 · 共 33 行

M
33
字号
function [x,y,jc] = LHIobjectpolygon(annotation, name);
% [x,y] = LHIobjectpolygon(annotation, name) returns all the regions that
% belong to object class 'name'. Is it an array Ninstances*Nvertices

if isfield(annotation, 'object')
    if nargin == 1
        jc = 1:length(annotation.object);
    else
        jc = LHIobjectindex(annotation, name);
    end

    Nobjects = length(jc);
    if Nobjects == 0
        x = []; y =[];
    else
        n=0;
        for i = 1:Nobjects
            n = n+1;
           if (isfield(annotation.object(i),'regions'))
                Nregions = length(annotation.object(i).regions);
                for j = 1:Nregions
                    [x{n},y{n}] = getLHIpolygon(annotation.object(jc(i)).regions(j));
                end
           end
        end
    end
else
    x = [];
    y = [];
    jc = [];
end

⌨️ 快捷键说明

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