本文主要是介绍击中击不中变换Matlab实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
matlab击中击不中函数为bwhitmiss,调用形式为:
Ihm = bwhitmiss(I, S1, S2);
% I为输入图像
% S1、S2为结构元素
The syntax bwhitmiss(BW1,SE1,SE2) is equivalent to imerode(BW1,SE1) & imerode(~BW1,SE2)
clear all;
I = zeros(120,180);
I(11:80,16:75) = 1;
I(56:105,86:135) = 1;
I(26:55,141:170) = 1;
figure,imshow(I);se = zeros(58,58);
se(5:54,5:54) = 1;
figure,imshow(se);%击中击不中变换
Ie1 = imerode(I,se);
figure,imshow(Ie1);Ic = 1 - I;
figure,imshow(Ic);
S2 = 1 - se;
figure;imshow(S2);
Ie2 = imerode(Ic,S2);
figure,imshow(Ie2);Ihm = Ie1 & Ie2;
figure,imshow(Ihm);
这篇关于击中击不中变换Matlab实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!