灰度阈值分割法:
(1)
b3=im2bw(b,120/255);
figure;imshow(b3);title('阈值b3');
(2)
[m,n] = size(e);%e为待处理图片
value = a;%设阈值为a
B = zeros(m,n)+255;
for i = 2:m-1
for j = 2:n-1
if e(i,j)<value
B(i,j) = 0;
end
end
end
imshow(e);
figure;
imshow(B);imwrite(B,图片途径);