⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fengebaohe.m

📁 医学外周学图片白细胞核的分割算法
💻 M
字号:
function fengebaohe
origin=imread('cell.jpg');
hsv=rgb2hsv(origin);
%提取S分量
saturation=hsv(:,:,2);
%OTSU法选取阈值分割细胞核
level = graythresh(saturation);
bw1 = im2bw(saturation,level);
%种子填充
bw2 = imfill(bw1,'holes');
%腐蚀膨胀得到细胞核,次数可视实际情况而定
time=5;     %腐蚀次数
bw3=bwmorph(bw2,'erode',time);
bw3=bwmorph(bw3,'dilate',time);   
bw4=edge(uint8(bw3),'canny');
%在原始图象上显示细胞核轮廓
origin_add=origin;
[m n]=size(bw4);
for i=1:m
    for j=1:n
        if bw4(i,j)==1
            origin_add(i,j,:)=255;
        end
    end
end
%连通域标记并计算细胞核质心
[L num]=bwlabel(bw3);
area=bwarea(bw3);
total_x=0;
total_y=0;
for i=1:m
    for j=1:n
        total_x=total_x+j*bw3(i,j);
        total_y=total_y+i*bw3(i,j);
    end
end
center_x=total_x/area;
center_y=total_y/area;
center_x=uint8(center_x);
center_y=uint8(center_y);
%计算细胞外部标识矩形的起始点
point_x=double(center_x)-90;
point_y=double(center_y)-90;
%分别显示原图,分割出的细胞核,叠加的细胞核,以及细胞外接矩形
figure,subplot(2,2,1),imshow(origin);
subplot(2,2,2),imshow(bw3);
subplot(2,2,3),imshow(origin_add);
subplot(2,2,4),imshow(origin);
rectangle('Curvature',[1,1],'Position',[point_x point_y 200 200]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -