⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thinning4.asv

📁 matlab代码
💻 ASV
字号:
function out = thinning4(in);

%thinning process obtain a one pixel wide image skeleton
% use function n_sum and t_sum

[w,h] = size(in);

out = in;

for i= 3:h-2
for j= 3:w-2

        if out(i,j) == 1
             if  out(i-1,j)+out(i,j+1)+out(i+1,j)+out
                if 1 < n_sum(i,j,out) &  n_sum(i,j,out) < 7 
                        if  t_sum(i,j,out) == 2
                                 if or ( and_157(i,j,out) == 0  , t_sum(i,j-1,out) ~= 2 )
                                         if or (and_357(i,j,out) == 0  , t_sum(i+1,j,out) ~=2 )   
                                     %        if and_157(i,j,out) == 0
                                     % if  and_357(i,j,out) == 0   
                                                out(i,j) = 0;
                                        else
                                                out(i,j) = 1;
                                        end;
                                else
                                        out(i,j) = 1;
                                end;
                        else
                                out(i,j) = 1;

                        end;
                end;

        end;                

end;
end;

⌨️ 快捷键说明

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