close all;clear all;clc;
% 开运算和闭运算
I = imread('testpic.jpg');
I = im2bw(I);
I = ~I;
se = strel('line',5,90);
J = imopen(I,se);
K = imclose(I,se);
figure;
subplot(131);imshow(I);title('原图像');
subplot(132);imshow(J);title('开运算');
subplot(133);imshow(K);title('闭运算');