I am trying to process a lot of images of bacteria. As you can see from this image, when several bacterias are very close, the boundary tends to be very fuzzy.

enter image description here

I try to binary the image or detect the edge use canny operator.But the result is unsatisfying.

So is there a right way to distinguish every cell in this situation?I want both get the right count and position of every cell. Thanks to all of you.


2 Answers 2


bacteria segmentation is a broad field with many approaches. here's an example. For your spesific image, I think you can do the following tricks:


ws=7; % window size 
mean_d=imfilter(d,fspecial('average',ws),'replicate'); % this is a local mean operation 

d3 = conv2(d2.*(d2>0), fspecial('laplacian',0),'same');

you can take it from there... enter image description here


I assume that you have already tried kind of edge detector - you should pay attention Hysteresis for Canny -

Second, you can try to image enhancement technique which name is Histogram Equalization. Histogram equalization makes darker parts more more darker and brighter parts will be more brighter. Then you can apply Canny or adaptive threshold to detect these bacterias.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.