Count and measure yeast cells from an image

5 views (last 30 days)
Hello. I am trying to detect, count and measure yeast cells from various images like in this example,
First I made the background uniform using a morphological opening, followed by an increase of the contrast using "imadjust". Then, I found the edges of the image using the 'canny' function to create a mask that overlays on the adjusted image to remove all the background and some of the cells glow. Next, I turned the pixels below 50 into black and converted the image into a binary one. Finally, I cleaned the image and used the “watershed” transformation to separate the connected cells.
Here’s my code:
clear all
close all
se1=strel('disk',2);
X=imread('t132-1.png');
I=X(:,:,2);
figure
imshow(I)
title('original')
drawnow
%%background removal
background = imopen(I,strel('disk',15));
I2=I-background;
I3 = imadjust(I2);
% figure
% imshow(I3);
% title('Adjusted image')
% drawnow
%%edge detection
Iedge=edge(I3,'canny',0.3);
Iedge=bwmorph(Iedge,'dilate');
Iedge=bwmorph(Iedge,'bridge');
Iedge=imfill(Iedge,'holes');
% figure
% imshow(Iedge)
% title('edge')
% drawnow
Iclean=bwmorph(Iedge,'erode',2);
Iclean=bwareaopen(Iclean,500);
% figure
% imshow(Iclean);
% drawnow
%%Image masking
Icut=255-I3;
Icut(Iclean==0)=0;
figure;
imshow(Icut);
title('cut')
drawnow
Iadjust=Icut;
Iadjust(Iadjust<50)=0;
% figure
% imshow(Iadjust);
% title('black pixels below 50');
% drawnow
Ibw=im2bw(Iadjust,0.1);
% figure
% imshow(Ibw);
% title('BW');
% drawnow
Ibw=imerode(Ibw,se1);
Ibw=imdilate(Ibw,se1);
Iclean2=bwareaopen(Ibw,150);
% figure
% imshow(Iclean2);
% title('clean')
% drawnow
%%watershed function
D=-bwdist(~Iclean2);
mask=imextendedmin(D,7);
D2=imimposemin(D,mask);
Ld2=watershed(D2);
bw3=Iclean2;
bw3(Ld2==0)=0;
figure
imshow(bw3)
title('Final')
drawnow
I plan to make the measurements using the “regionprops” command. My problem is that the resulting image (shown below) lost many of the cells forms and have outter holes that difficult the measuring process. I’m wondering if you have any suggestion for a better general detection process that I could apply on all my 36 images, thanks in advance!

Accepted Answer

Image Analyst
Image Analyst on 22 Sep 2015
Maybe try either imfill() or bwconvhull().
  5 Comments
Image Analyst
Image Analyst on 29 Sep 2015
Did you try imfill() at a strategic place in your algorithm? I might be able to improve on it, but it would take a long time. Sorry but it would take more development time than I can spend on it. I'd just try imfill() at some point and vary the parameters in Steve's algorithm to see if you can improve it. Otherwise if you just want a count you can use manual counting with ginput() or impoints() or else just go with area fraction as your thing to measure.
Luis Farías
Luis Farías on 29 Sep 2015
Ok, I'll try that. Thanks for everything.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!