Bacterial Motility Analysis Software/Hardware Project

Hello everybody!

I want to share my recent project because I am looking for feedback (and for people who want to join :slightly_smiling_face:)

TL;DR:Dark field agar plate imaging setup + computer vision (possibly + machine learning) based analysis of macroscopic bacterial movements. Could be used to possibly distinguish pathogenic/non-pathogenic bacteria strains in the field (Project repository)

It is getting a little bit techy down there but I wrote an approachable version in the README of the project repository


Some time ago I started monitoring my bacteria with a camera in the incubator during swarming motility (special type of “group movement”) experiments and generated time-lapse videos to show them in our lab seminar. Using these images I tried to calculated the migration area of the bacteria from the pictures which worked surprisingly well and I was able to plot migration curves from the results.

The biggest challenge I faced was to take “good” pictures in the incubator. At some point I stumbled over a publication describing a dark field imaging setup. Unfortunately building the setup would require a metal workshop and probably also some sophisticated tools and electronics. Thats why I am currently trying to create a 3D-printable dark field lighting setup which is based on the same principles but would be easier to recreate.

However, also the picture analysis is still very noisy and I think using computer vision possibly paired with a machine learning approach could heavily improve the image analysis and might also enable shape and migration direction analysis.

Finally I want to combine both, build a imaging setup with a attached single-board computer + camera which can run an on-line image analysis.

Analyzing swarming motility is highly relevant especially when you want to distinguish non-pathogenic and pathogenic bacteria (strains, pathovars etc) in a classical descriptive microbiology approach. This obviously has to be cross-checked with other methods but it would be an easy and low-tech approach. For now it is no quick test and it also requires an isolated strain but maybe there will be workarounds!

Well, obviously this won’t be restricted to swarming motility assays! It could be combine with software which is already out there (like openCFU) to create a CFU counting station etc.

I could be also combine with other projects. For example this would be also a great module for the FlyPi @amchagas

This project is also featured on Mozilla Pulse and will be one project of Mozillas’s Global Sprint in two weeks (10.-11.05.18) because I started working on it as part of the Mozilla Open Leaders program.

In the project repository you can find some more informations about the scope, roadmap and things we are currently working on. So If you want to join the project or know somebody who might be interested in it, get in touch :slightly_smiling_face:

All your ideas, comments and feedback is welcome.



Edit: Removed Image HTML code because it didn’t work and uploaded the gif directly


Hi Alex, I’m working on a rpi camera for cell image processing. Where is you team located?

Hi @vektor, thanks for sharing this.
You might be interested in our project on paenibacillus studies with open hardware (in collaboration with @keymer and @paloma

Also this project on whole plate (or single colony) time lapse fluorescent imaging with @keymer and @tim

Cheers, F.

1 Like


Thank you very much for your responses!

@ce11 For now my team is just me and I am located in Munich, Germany. I am affiliated to the Chair of Phytopathology at the Technical University of Munich but this project is a private one and not part of my “regular work”. But a postdoc from the US recently contacted me and told me that he would be up for testing the final “product” in his lab.

What kind of processing are you working on?

I am really sorry but my spanish is not good enough to fully understand the project description but I think I somewhat get the idea. But you are more focussing on microscopic movements, did I get this right?
The videos are really great and I should try something similar with my bacteria (it’s Pseudomonas btw.) just to see how they would behave.

Would you be also interested in macroscopic movements?

And thank you for the link to the fluorescent imaging setup! I had a look into the repo and the explanations in the jupyter notebooks is really great.
only scikit-image is used for the analysis, right? I was thinking about using openCV but I just had a quick look at scikit-image and it would be worth a try to apply it to my time lapse images.

For the illumination I am using a super simple design:
It improves the quality of agar plate images very much. I just need to design a lid with a RPi camera slot to finalize the setup. I don’t have any example pictures at hand and I don’t have access to a lab for the next weeks but here is the publication (with example pictures) describing the setup I was inspired by.

Thanks again for your feedback!


Super cool Alex!
I took a look at the repo, I really like how things are organized and setup for collaborations.
Let me know if you would like to use parts of the FlyPi for it, we can change code for user interface and so on…

@ce11: Also interested to know more about your project! If you are playing around with PiCameras, take a look at our project the FlyPi There is some code already implemented for user interface with the Camera (click and point for movies, images, time lapses, as well as file conversion) and to control its properties (digi zoom, brightness, contrast, resolution, etc). Maybe it is useful?

1 Like

Hi Alex, I’m building a lab robot. It has an XYZ rig, Pi Camera, and its running on a Protoneer board. I’m currently working on image processing. I’m using OpenCV to count cells via time-lapse and Identifying cell division rates. Transformed bacterial divide slower. My goal is to identify transformation e. Coli via regular e.Coli and using a pinpoint laser to kill non-transformation e.coli.

I’ve been debating on writing my own GUI for this lab robot, but I feel like its going to take too long :smiley:

Hi @vektor that´s really good. We were using something similar for whole-plate time-course of fungal growth but using lateral diffusive light instead (when I say we I should say Isaac, Tamara and Daniel who did most of this work in our group). Your design looks great. We will try it.

Yes. Leslie, @paloma and @keymer can tell you more about their work for XY colony tracking (two different approaches). I have been working more on the tube lens design for single colony imaging.
For whole plate imaging, I would suggest the design used in FlyPi for M12 lenses. I made an updated version of the M12 case from Marco Vaquera to add a thread in the holder for V2 RPI camera. This design fits better with the M12 lens (code & STLs here)

For camera control, I also suggest FlyPi interface! It is great.