Monday, 11 March 2013

Microscope autofocus

To make automated microscopy testing possible, e.g. for malaria screening, one issue is being able to physically focus the microscope. This can take some skill, so being able to do it automatically - in addition to the visual diagnosis - makes the test easier to use for health workers with only basic training.

MSc student John Wekesa has been working on a combination of software and hardware to do this automatically. Here is a prototype, with a camera mounted on a simple scope and a servo motor controlling the focus:


Some Python code controls the motor, using feedback from the camera. The objective function is the magnitude of the Canny filtered video frames (roughly speaking, a measure of how strongly defined any edges in the image are). We can then apply a search of focus wheel positions to maximise this objective.

Here's the prototype having found focus (on a piece of onion!):


Also in progress is motorising the panning controls on the scope, in order to fully automate the procedure. The idea would be to place a slide on the microscope stage, then 3 motors (pan x, pan y, focus) control a scan of all fields of view in the sample. The computer vision code then analyses each frame in order to produce a final diagnosis.