Matlab 细胞培养图像的细胞分割:背景像素分类错误
我需要分割细胞培养图像中的一些细胞,我有一些错误地将背景区域划分为前景的问题 我使用Matlab 细胞培养图像的细胞分割:背景像素分类错误,matlab,background,cell,image-segmentation,Matlab,Background,Cell,Image Segmentation,我需要分割细胞培养图像中的一些细胞,我有一些错误地将背景区域划分为前景的问题 我使用imbothatmatlab函数进行背景减除(存在大量均匀照明),然后使用gmm在两个区域(背景与单元)进行分类,得到了一些好结果 然而,imbothat渲染一些与单元格区域非常相似的背景像素,然后gmm(二值化阈值可能在图像之间变化很大,我不想主观地选择它)执行不好的分类 有人知道如何解决这个问题吗 我尝试向gmm添加一些额外的数据(除了Igraywobvd),例如stdfilts或entropyfilts,但
imbothat
matlab函数进行背景减除(存在大量均匀照明),然后使用gmm
在两个区域(背景与单元)进行分类,得到了一些好结果
然而,imbothat
渲染一些与单元格区域非常相似的背景像素,然后gmm
(二值化阈值可能在图像之间变化很大,我不想主观地选择它)执行不好的分类
有人知道如何解决这个问题吗
我尝试向gmm
添加一些额外的数据(除了Igraywobvd
),例如stdfilts
或entropyfilts
,但结果没有任何改善
如果我将strel减少到20(或更少),这些“有问题”的背景区域不会突出显示,但我会丢失许多单元格区域
这是原始图像:
这是我获得的序列(指示错误的分类区域):
我的matlab代码如下:
for jpg_file=1:length(jpgsinfolder)
I=original_images{jpg_file}; %figure; imshow(original)
Igray=rgb2gray(I); %figure; imshow(Igray)
%Substract background
Igraywob=imbothat(imadjust(Igray), strel('disk',50)); %figure;
imshow(Igraywob)
%GMM
%Convert input images to double vectors and generate the dataset
Igraywobvd=double(Igraywob(:));
%Add data to the final dataset
gmm_dataset=horzcat(Igraywobvd);
%GMM
opt = statset('MaxIter',15000,'TolFun',1e-6);
gmm =fitgmdist(gmm_dataset,2,'Options',opt,'CovType','diagonal','RegularizationValue',0.01);
%----Probability of our pixels to belong to the fitted distributions
prob = gmm.posterior(gmm_dataset);
%------save labels of the major probability
[val, labels_gmm] = max(prob,[],2);
%Reshape vector with the original image size
labels_gmm=reshape(labels_gmm,size(Igray,1),size(Igray,2)); %figure;
imagesc(labels_gmm2)
%Chose the labels with highest intensity (corresponding to the cells)
med1=mean2(Igray(labels_gmm==1));
med2=mean2(Igray(labels_gmm==2));
if med1>med2
labels_gmm(labels_gmm==1)=0;
labels_gmm(labels_gmm==2)=1;
else
labels_gmm(labels_gmm==1)=1;
labels_gmm(labels_gmm==2)=0;
end
%Binarization
labels_gmm_bin=labels_gmm>0; %figure; imshow(labels_gmm)
%Delete small objects (artifacts)
labels_gmm_op=bwareaopen(labels_gmm_bin, 500); %figure; imshow(labels_gmm_op)
%Close small holes inside the cells
cellmask=imclose(labels_gmm_op, strel('disk',1));
%Can see the final result:
cellmask_results = labeloverlay(Igray,cellmask,'Transparency',0.7);
figure(jpg_file); imshow(cellmask_results)
end
你可以尝试应用形态学开口()来过滤掉小区域,但它也会删除对象的薄区域,我不确定这是否有问题。你可以尝试应用形态学开口()来过滤掉小区域,但它也会删除对象的薄区域,我不确定这是否是个问题。