m_connect.m
来自「matlab代码」· M 代码 · 共 33 行
M
33 行
function [out] = m_connect(in);
% apply m_connectivity to the one pixel wide image
% 2/12
[w,h] = size(in);
out=in;
for i=3:h-2
for j = 3:w-2
if out(i,j) == 1 & out(i+1,j+1) == 1
out(i+1,j) = 0;
out(i,j+1) = 0;
end;
if out(i,j) == 1 & out(i-1,j+1) == 1
out(i,j+1) = 0;
out(i-1,j) = 0;
end;
end;
end;
imagesc(out);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?