MATLAB医学图像分割
实验目的:
- 了解图像分割的基本理论和方法;
- 掌握阈值分割的方法和阈值的选择;
- 掌握基于分水岭分割的原理和应用;
实验内容:
- 区域生长法利用图像像素间的相似性进行分割,调用regiongrow函数对图像weld.tif进行处理,注意参数中S(种子值),T(阈值)的选择对分割效果的影响。S=255,T=65和S=255 T=150和S=150,T=65三组值进行处理,理解在区域生长法的原理。同时对liver.bmp,自己选择合适的S和T,以较好得分割出肝脏。
代码1:
close all;
f=imread('weld.tif');
figure(1),imshow(f),title('原图');
[g1,NR]=regiongrow(f,255,65);
[g2,NR]=regiongrow(f,255,150);
[g3,NR]=regiongrow(f,150,65);
figure(2),imshow(g1),title('S=255,T=65');
figure(3),imshow(g2),title('S=255,T=150');
figure(4),imshow(g3),title('S=150,T=65');
[y,x]=ginput();
x=floor(x);
y=floor(y);
G=zeros(size(g));
G(g3==g3(x,y))=255;
结果:
![v2-d964033fdf9eb4b2303128f6f55c69e6_b.jpg](https://img-blog.csdnimg.cn/img_convert/3e6cdaa30eebe4cb670f727ea4481af7.png)
![v2-d331a0afbae8bc162778d1d92a420b3a_b.jpg](https://img-blog.csdnimg.cn/img_convert/db244cea401a3335c75d5c1ef65a39fc.png)
![v2-43b608eef696984cd51124964efb4b70_b.jpg](https://img-blog.csdnimg.cn/img_convert/da1e87882734d8607ade6da0736e37ee.png)
![v2-189629f0b246b4fd0e65ea2244ed90cb_b.jpg](https://img-blog.csdnimg.cn/img_convert/13b6449084cbf051c28760ad6ed50b3c.png)
代码2:
close all;
f=imread('liver1.bmp');
figure(1),imshow(f),title('原图');
g=regiongrow(f,255,135);%肝脏分离
figure(2),imshow(g),title('S=255,T=135');
[y,x]=ginput();
x=floor(x);
y=floor(y);
G=zeros(size(g));
G(g==g(x,y))=255;
figure(3),imshow(G);
结果:
![v2-915c1f08778d03b4dfe46b1298d5dfe7_b.jpg](https://img-blog.csdnimg.cn/img_convert/f0ee522ef73242616b6f1b1257e1ee42.png)