Demo entry 6645038

10.8

   

Submitted by anonymous on Oct 08, 2017 at 17:51
Language: Matlab. Code size: 448 Bytes.

im_input = imread('4.tif');%读取图像
I=im_input(:,:,1:3);%rgba转rgb
I1=imsharpen(rgb2gray(I));%转灰度图像,锐化
thresh = graythresh(I1);     %自动确定二值化阈值
I2 = im2bw(I1,thresh);       %对图像二值化
figure, imshow(I2),title('输入图像');

se1 = strel('disk', 9); %构造结构元
im_output1 = imerode(I2, se1);%腐蚀运算
se4 = strel('disk', 1); %构造结构元
im_output2 = imopen(im_output1, se4);%开操作
 

figure, imshow([im_output1]),title('处理结果 ');
[L,num]=bwlabel(im_output1,4);%计数

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).