Automated polarimetric microscope

Polarimetric camera with a microscope lens attached to a 3d printer.

Public Chat
Similar projects worth following
I recently got the raspberry HQ camera and a compatible microscope lens. Fun, but it needs to be mounted to something sturdy before it is of any real use. So I thought, let's remove the extruder from my 3d printer and mount the lens instead. Now I can precisely move the microscope around and use the Z axis to focus.

Now, as it happens, I have a polarimetric camera (Allied Vision Mako G-508B POL) laying around which I use to detect angles of surfaces (work stuff) and it is a C mount as well. So I started wondering whether it could detect the angle of polarization on a microscopic scale. The results are mesmerizing!

About polarimetric imaging

Here is some more info on the polarimetric sensor and how it works: Polarsens

The raw images from the sensor are transformed into color by calculating the angle and degree of polarization from the difference in luminance between filter angles, and using them as "hue". The resulting color is multiplied by the degree of polarization (maximum value - minimum value) which will remove both underexposed as well as overexposed pixels. A modified sobel filter detects edges which would otherwise result in false polarization values. The sobel filter creates the white lines in the pictures.


I really wanted to show off the mesmerizing images I get from this setup, but I realize that this project is too expensive for most people that don't have access to these cameras at their job. The good news is that:

  • A) This project is also fun to do with a RPi and HQ camera. The microscope lens was one marketed as one for the RPi HQ camera.
  • B) I've made my own polarimetric camera before and in a future project i will show you how to make one on a budget. (aiming for 100 - 200 euro, the Mako costs around 2500 euro)

This project uses a Jetson Xavier NX, but works equally well with a Jetson Nano or a laptop/desktop with a proper GPU and an ethernet connection. It doesn't work (yet) with a raspberry PI, because of GigE vision and UDP MTU restrictions in the kernel. I'm looking into this in another project, but might scrap that in favor of a homemade polarimetric camera based on the HQ camera for raspberry PI.

Moving the microscope

The microscope is moved by sending raw GCODE to the 3d printer. This may sound daunting, but it really isn't. There is only one real command, which is G0. This command will move to a certain location, defined by X,Y,Z and E (for pitch or zoom) in mm. 

The E axis is a bit more tricky, E defines how many mm of filament is pushed into the extruder and depends heavily on your setup. You can use M92 to set the steps per mm to a lower value, like 10, which would mean that 10mm adds up to 100 steps is half a rotation of the shaft.

What about the images?

The first image is just plain sugar.

Second is the complete setup with angle controlled microscope lens, which has since been replaced by a fixed angle, variable zoom setup.

The initial prototype which proved that it is possible to see polarization through the microscope lens. The subject is a methcathinone crystal.

The blue-green one is a raspberry logo on a RPi.

The last one is the foot of a hamster skeleton.

Random stuff under the microscope

  • 1 × NVIDIA Jetson Xavier NX
  • 1 × Allied Vision Mako G-508B POL Polarimetric camera
  • 1 × Microscope lens Simple cheap one that is sold for the RPi HQ Camera
  • 1 × 3D Printer

  • Version 2

    E/S Pronk10/26/2021 at 00:03 0 comments

    It took me a while, but I decided to make a new printer, which meant dismantling the polarimetric microscope for parts. Even though the printer isn’t ready yet, it was capable of doing xyz and e (for zoom). I’ve been working with new polarimetric sensors that have twice the resolution in x and y, so I thought let’s give it a try once more. 

  • Through my eyes

    E/S Pronk02/19/2021 at 17:44 0 comments

    Today I turned the microscope on myself, boy oh boy polarimetric imaging is NOT flattering AT ALL. Except for the eyes, so here are 2 videos.

  • Going slow...

    E/S Pronk02/15/2021 at 12:00 0 comments

    As you might have noticed there are some vibrations in the video, these are due to me typing at 1.5m from the printer. It is that sensitive! That makes it even more impressive to me how little vibration there is from the stepper motors when it moves.

    The stepper drivers are TMC5160s with microPlyer (interpolation between steps) and StealthChop (noiseless operation at low speeds) technology.

    This is my setup. Yes it is messy. Yes that's a piece of lego to stop a pin from shorting...

  • Version 2

    E/S Pronk02/14/2021 at 16:22 0 comments

    After some heavy refactoring of the CUDA code the software can now keep up with the framerate! The biggest bottleneck was the pow function in CUDA. I replaced it with a log / exp combo and now it is flying!

    I also 3d printed a contraption that controls the magnification of the lens. A NEMA 8 motor is connected to the 3d printer as extruder motor. This means smooth and coordinated moves for X, Y, Z and E. The lens has some drawbacks: it won't keep focus when zoomed, so each zoom is accompanied by a small change in Z to try and keep the lens focused during zooming.

    Finally, I made a video and posted it in the details section!

  • Version 1

    E/S Pronk02/11/2021 at 17:44 0 comments

    So version 1 is now done! I have made a few pictures that show the potential, I think they are awesome!

    I hooked up the microscope lens to the extruder motor, which gives me control of the angle of the lens. The camera has an external shutter option which I hooked up to the fan pins, this allows me to time the captures in between the movements. I am kind of thinking it might be possible to do multiple view geometry of microscopic objects, or stitch the individual images together into superresolution pics. On the other hand it might also be cool to use the extruder motor for the zoom function of the lens and make some cinematic passes of objects.

    At the moment the framerate is too low to do this, but I'm working on some CUDA optimizations that should resolve that issue.

    Right now, I have to dismantle the thing because I need to do some printing. But next update should be interesting!

View all 5 project logs

Enjoy this project?



Ahron Wayne wrote 02/26/2021 at 17:53 point

Ive never seen polarimetric images like this but boy are they super cool! Have you been doing stacking/stitching at all? I'd love to see that with your hardware! Hope we can compare notes sometime.

  Are you sure? yes | no

Dan Maloney wrote 02/12/2021 at 18:18 point

Very cool, love polarization photomicrography. We used to have an "Art of Science" contest back where I used to work, and every year it seemed like the polarization photos were easy winners. Looking forward to the how-to on making a polarimetric camera.

  Are you sure? yes | no

E/S Pronk wrote 02/14/2021 at 16:11 point

Thanks! yeah I can imagine, I've been working with polarization images for almost 2 years and still think they are mesmerizing to this day :) 
I like the idea of that contest, more companies should do that!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates