Other Blog Posts
Lucida - Microscopy Image Capturing and Focus Stacking
2025-03-19
The problem
If you have ever tried to take photos from a small object you are probably familiar with the problem that with an increase of magnification the attainable depth of field becomes smaller. Microscopy imaging is particularly prone to this since at higher magnifications the depth of field easily becomes smaller than the height profile of the object.



Enter Lucida
There are some very good open source focus-stacking solutions, however they all take an existing image stack as input. In a typical workflow one wants to see the composite result immediately after capturing images - this is where Lucida jumps in.
It features a GUI based on egui
that allows you to capture images from v4l
devices and set some options, then after capturing it will process the image stack and immediately render the final result.
Acceptable performance is achieved with the help of OpenCV and asynchronous Rust.
The name comes from a device called Camera lucida that was in use in the 19th and 20th century as a drawing aid to create in depth drawings of objects examined with a microscope.
Lucida is available here: https://gitlab.com/tschorr/lucida.
You'll need Linux, Rust, OpenCV and of course a camera attached to your computer to be able to use Lucida. Future development might address the inclusion of other focus stacking algorithms and porting the application to other platforms, namely Android.