How to segment cells that are closely aligned (Phase Contrast Image)
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
i'm having a little trouble segmenting the attached images, both should be segmented using the same lines of code. The overall aim is to count and mark the cells in the images.
%%Read image and convert to grayscale
orgImg = imread('pc_cellcounting_pc1.png');
grayImg = rgb2gray(orgImg);
entropyImg = entropyfilt(grayImg, true(5));
entropyImg = gvimscale(entropyImg,[0 1]);
medianImg = medfilt2(entropyImg, [5 5]);
medianImg = medfilt2(medianImg, [15 15]);
adjustedImg = imadjust(medianImg);
eqImg = histeq(adjustedImg,255);
%%Image Thresholding
% Only very bright pixels are kept
bwmask = imbinarize(eqImg, 0.9);
bwmask1 = imcomplement(bwmask);
bwmask1 = double(bwmask1);
% set background to 0
eqImg1 = eqImg - bwmask1;
eqImg1(eqImg1 < 0) = 0;
% separate some of the clustered cells
%%Image Opening by reconstruction
se = strel('disk', 10);
erodedImg = imerode(eqImg1,se);
erodedAndReconstrImg = imreconstruct(erodedImg, adjustedImg);
finalImg = imbinarize(erodedAndReconstrImg, 0.65);
% fill the cells and get the perimeters
finalImg = imfill(finalImg, 'holes');
%%Visualization and counting of the centroids
% extract the centroids
stats = regionprops(finalImg, 'Centroid');
N = num2str(size(stats, 1));
C = cat(1,stats.Centroid);
% create the image
figure_handle = figure;
axes_handle = axes('Parent', figure_handle);
imshow(grayImg)
title(axes_handle, ['Number of cells ', N])
hold(axes_handle, 'on')
plot(axes_handle, C(:,1), C(:,2),...
'go','MarkerSize',4,...
'MarkerEdgeColor','b',...
'LineWidth',2,...
'MarkerFaceColor','g')
So far i came up with this code, but i'm not very happy with the result. My troubles are mainly the weak contrast between the background and the cells, as well as the close alignment of the cells. I was mainly using the weaker pixel intensity at the transition of the cells to separate them, but this only works for some of them. Maybe you have some better ideas, because at the moment i'm quite stuck.
Thanks a lot!
0 comentarios
Respuestas (1)
Image Analyst
el 26 de Sept. de 2018
This problem has been worked on for ages. It's a tough one but there are successful approaches. Search the Image Processing literature for more ideas: http://www.visionbib.com/bibliography/contents.html
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!