Counting bacteria using imageJ



I am using a Live\ dead staining protocol. (Link to Manuals & protocols:

Briefly, This assay stain Live bacteria in Green as well as dead bacteria in Red.

I am interested in finding the actual number of all red bacteria (dead) and Live (green) bacteria.
Please see the attached pictures as my representative pictures for analysis.
I am using a fluorescence microscopy (Nikon - Dual Band Excitation Filter Sets) in order to get this RGB pictures.
I really tried everything. but I couldn’t find or design a protocol that will count all

My starting point is to press “Color – > split channels” ( this way I can discard the blue channel that I am not interested in).
Moreover, please note that bacteria size in about 2 microns ( which is equal to 13 pixels in this picture) and their shape can vary from ellipse to rings.
one last thing - bacteria can generate 3D structures and assemble together (one bacteria above other bac

teria) or can be by themselves (one bacteria next to other).

I mostly interested in counting those individual bacteria, but if there will be a protocol that I can count those 3D structures of bacteria, in addition, it will be the best.

I welcome all suggestions from the forum members,
Please help me :pray:



I’m sure some of us here on the forum will be working on this, but we are not known for being really quick so please be patient. I for one am working on it.

Good Luck!


Dear and most appreciated Bob,
Thank you very much for your reply. I will be patient and hope you will find a suitable solution to my question.

Best regard,


Hi Jack!
Don’t say that loud in an Airport, you might get tackled.
Anyway I have your images (several) and their analysis all in one folder. If I understood what you wanted. It’s quite involved so if this is what you wanted, respond back. I should have it all written up shortly, This site won’t let me send any of the results so I’ll have to reformat them and send to you


Green Results.csv (105.3 KB)
Jacks%20RGB|nullxnull Red Results.csv (58.9 KB)
RGB Results.csv (40.1 KB)
YellowResults.csv (18.8 KB)


Dear and most appreciated Bob,
Thank you very much for your reply.

First, i wanted to thank you for your ambition to help me. I am truly grateful for that.

Secondly, as for the analysis - it seems like you took image number 9 ( I uploaded tree images with different numbers - 9, 11 and 17) for analysis, am i correct?

It is very hard for me to understand what you did here but i think you are in the right way. I found a good match in some areas.

To further clarify my question i am uploading one more image (named “9_clarify my question”). This image is identical to the one you did the analysis, except there i marked green bacteria in purple and red bacteria in blue. (These bacteria are one next to another)
My goal is to produce a protocol that, after ImageJ analysis, will give me the results (for the marked field) of:
5 - red bacteria
3 - green bacteria

Is that what you tried to do?

Of course, the marked area is just an example, i wish this counting will suitable for all the picture.
I know this is very challenging, especially for all the 3D structures (lump of bacteria - which usually have green and red colors together - this kind of example marked in gold).

In your answer, I am not sure what the “YellowResults.csv (18.8 KB)” and “RGB Results.csv (40.1 KB)” files means… since i am only interested in the red and green channels (and count) .

I hope this has clarified my challenge.

Thank you very much for your help,


Hello Jack ( notice I didn’t say hi Jack )

I better understand what you want now, because formerly you wanted the stacked bacteria also which show up as yellow. due to the way RGB cameras portray colors.

I’ll redo it and send you the results.



Hello Bob,
Please note that my primary goal is to count the red and green bacteria (those which are one next to another) “separately”, and by that will know the ratio between them in the picture. By “separately” i mean that i need the number of just green bacteria and the number just red bacteria. If that requires two sets of running scripts/ protocols - that is what i will do (the thing here is to avoid a situation that red bacteria will count as green and vis versa). That is why i started my protocol in imageJ in “image — >color — > split channels” and discarded the blue channel. and i don’t know if it is good, just from basic logic.
It worth to emphasize that i am using a fluorescence microscopy (Nikon) with Dual Band Excitation Filter Sets which mean that i get both fluorescence emission wavelength of the red and green channels together.

However, my secondary goal is to count, if possible, those 3D structures (as you said “stacked bacteria”). also here, i don’t care about the total amount of bacteria- only how many of them are red and green so i can determine the ratio between them in the 3D structures.

Once again, thank you very much in trying helping me. I am truly grateful for that.
I wish you all the best


Dear bob,
I assume your time schedule is very busy. I hope to progress with my research and I am writing this for a humble request to know if there has been any progress with the protocol…?



Hello Jack,​

Yes Jack, I am sending 3 samples so that you can pick which one suits your need. All 3 were processed differently so the procedure will depend on which one you choose, just let me know.​

The one that is over enhansed is included to show you the noise you can encounter in some images ( Top Left) so be careful.​

The one with yellow shows how many overlap each other.​

And the last one is strickly Red and Green​.

The images are too large to send via E-mail so I’ll send them on both on Forum and One drive.

Contact Me,​



Just%20R_G|nullxnull Just%20R_G-A|nullxnull Just%20R_G-B|nullxnull


Dear Bob,
I have sent you a private message with my email so you can send me the pictures



Hello once again Jack,
The images are on the forum page. You can copy them by right clicking and select “Save As”.
Image 1 is strictly Red and Green, obtained by split channels (KEEP ALL THREE because you need to subtract the Blue channel from both the red and green channels).
Just discarding the Blue channel still leaves some blue hidden within the other colors. After that, merge just the red and green channels and lighten and contrast to taste.
Image 2 was done the same way but over enhanced to show the noise you will have to deal with in some images, so be careful.
Image 3 was done without subtracting blue, just discarding and merging the red+green, illustrating the overlap of some of the bacteria. So you probably need both image 1 and image 2 for fine detail of your math,
I also will send the other two examples (#11 and #17) with this message to the forum page.
If you have any further questions feel free to ask.

Bob11%20TestRGB|nullxnull 17%20testRGB|nullxnull


11%20TestRGB|nullxnull 17%20testRGB|nullxnull




Dear bob,
Yes. I succeeded in downloading the files.
The protocol that I will choose supposed to match the number of bacteria in all my pictures.

Pictures 1 and 2 might good for me.

Reminder - bacterial are 2 microns in size, so if I have some “dots” that are under 1 (7 pixels) micron or above 3 (21 pixels) I am not interested to take them into account.

How do I count all the bacteria? can I determine a range of pixel that will be taken for analysis? I have attached a PDF file with the protocol? what should I do in stage 4? when I discard the blue channel?
Protocol for bacterial count sent to bob from imagej forum.pdf (498.6 KB)

Can you please give detailed explanations of the procedure?

Many thanks,


Hey there Jack,
You might try also getting your spelling correct (just kidding) anyway you keep the blue channel to subtract it from both the red and green channels ( residual blue is always left over) using Process > image calculator. Then you subtract the red from the green and then the green from the red leaving you with just straight red and green. Lighten or what have you then go to Analyze > Analyze particles, adjust for size and what ever other data you wish. It will count them, list results of all data requested. Hope this helped. I’m slow but still here if you have further questions.