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;
结果:
代码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);
结果: