thinning2.m
来自「matlab代码」· M 代码 · 共 46 行
M
46 行
function out = thinning2(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 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 + =
减小字号Ctrl + -
显示快捷键?