Difference between revisions of "Team:Cambridge-JIC/Autofocus"
KaterinaMN (Talk | contribs) |
m (Slight editing of the text) |
||
Line 37: | Line 37: | ||
<div style="width: 100%; padding: 0% 10%; margin: 30px 0px;color:#000"> | <div style="width: 100%; padding: 0% 10%; margin: 30px 0px;color:#000"> | ||
<h3>The Problem</h3> | <h3>The Problem</h3> | ||
− | <p>Since the start of the OpenScope project, we | + | <p>Since the start of the OpenScope project, we aimed to turn our microscope into a fully automated, autonomously operable system. As such, it could not lack the <b>autofocus</b> feature. Autofocus is especially useful in certain experimental setups such as:</p> |
<ul> | <ul> | ||
<li><p>time lapse imaging - to account for stage drift/settling with time</p></li> | <li><p>time lapse imaging - to account for stage drift/settling with time</p></li> | ||
Line 50: | Line 50: | ||
<div style="width: 100%; padding: 0% 10%; margin: 30px 0px;color:#000"> | <div style="width: 100%; padding: 0% 10%; margin: 30px 0px;color:#000"> | ||
<h3>The Solution</h3> | <h3>The Solution</h3> | ||
− | <p>The strategy of the autofocus algorithm is to calculate the <b>focus score</b> for each frame imaged while gradually changing the sample-objective distance, until the score is maximized. This corresponds to the most sharply focused image. The physics behind the process is very simple: image of an object, viewed through a lens, is produced at a particular distance from the lens; at any shorter/longer distance the light rays from a single point on the object do not converge into a point, and therefore the image is blurred. The focus score can therefore be simply regarded as a mathematical function with a single maximum. However, multiple methods exist for | + | <p>The strategy of the autofocus algorithm is to calculate the <b>focus score</b> for each frame imaged while gradually changing the sample-objective distance, until the score is maximized. This corresponds to the most sharply focused image. The physics behind the process is very simple: image of an object, viewed through a lens, is produced at a particular distance from the lens; at any shorter/longer distance the light rays from a single point on the object do not converge into a point, and therefore the image is blurred. The focus score can therefore be simply regarded as a mathematical function with a single maximum. However, multiple methods exist for automatic focussing. The challenge was to find the most robust one. Here is what we tried: |
<ul> | <ul> | ||
<li><p>Tested out focus scores based on variance since this was recommended by both sources [1][2] on artificially blurred out images (Gaussian blur with different standard deviations). This worked well. Variance was chosen as the focus measure to implement since it is quick to evaluate, and numpy has a function that does this already.</p></li> | <li><p>Tested out focus scores based on variance since this was recommended by both sources [1][2] on artificially blurred out images (Gaussian blur with different standard deviations). This worked well. Variance was chosen as the focus measure to implement since it is quick to evaluate, and numpy has a function that does this already.</p></li> | ||
Line 60: | Line 60: | ||
<li><p>Implemented the parabola approximation to find in focus position. </p></li> | <li><p>Implemented the parabola approximation to find in focus position. </p></li> | ||
</ul> | </ul> | ||
− | <p>Gradient search, which is a simple technique | + | <p>Gradient search, which is a simple technique to locate local extrema, was also attempted, but did not give satisfactory results, as the learning rate required for convergence was slow. Also, noise from images drastically disrupted the calculations. This was a significant problem even when the gradient was calculated by taking multiple pictures around the point of interest. </p> |
<center><img src="//2015.igem.org/wiki/images/d/da/CamJIC-Software-Autofocus-Example.jpg" style="width:40%;margin:10px"><img src="//2015.igem.org/wiki/images/b/b1/CamJIC-Software-Autofocus-Graph.png" style="width:40%;margin:10px"><p><i>Autofocus algorithm in action: the plot shows the increase of the variance (i.e. the focus score) of the image with each iteration.</i></p></center> | <center><img src="//2015.igem.org/wiki/images/d/da/CamJIC-Software-Autofocus-Example.jpg" style="width:40%;margin:10px"><img src="//2015.igem.org/wiki/images/b/b1/CamJIC-Software-Autofocus-Graph.png" style="width:40%;margin:10px"><p><i>Autofocus algorithm in action: the plot shows the increase of the variance (i.e. the focus score) of the image with each iteration.</i></p></center> | ||
<p>The performance of the final autofocus algorithm varies, depending on the starting point of the search. A typical processing time is around 40s, which allows for autofocus during live-stream imaging through the <a href="" class="blue">Webshell</a>.</p> | <p>The performance of the final autofocus algorithm varies, depending on the starting point of the search. A typical processing time is around 40s, which allows for autofocus during live-stream imaging through the <a href="" class="blue">Webshell</a>.</p> | ||
− | <p>The autofocus algorithm we have | + | <p>The autofocus algorithm we have implemented is open for further improvements and performance enhancement. Ideas for future development include a threshold value to indicate the event of reaching max focus, and hence to stop the search, automatic measurement of the actual height to the CCD, better motors to improve precision etc.</p> |
<hr> | <hr> | ||
− | <center><p><i>The Autofocus algorithm we have developed can be found in the <a href="" class="blue">full software package</a>. It was developed | + | <center><p><i>The Autofocus algorithm we have developed can be found in the <a href="" class="blue">full software package</a>. It was developed by Rajiv, with useful feedback and advice from the rest of the Software team.</i></p></center> |
<hr> | <hr> | ||
<p style="font-size:80%">References:<br>[1] Firestone, L., Cook, K., Culp, K., Talsania, N. and Preston, K. (1991). Comparison of autofocus methods for automated microscopy. <i>Cytometry</i>, 12(3), pp.195-206<br>[2] Wu, Q., Merchant, F. and Castleman, K. (2008). <i>Microscope image processing</i>. Amsterdam: Elsevier/Academic Press.</p> | <p style="font-size:80%">References:<br>[1] Firestone, L., Cook, K., Culp, K., Talsania, N. and Preston, K. (1991). Comparison of autofocus methods for automated microscopy. <i>Cytometry</i>, 12(3), pp.195-206<br>[2] Wu, Q., Merchant, F. and Castleman, K. (2008). <i>Microscope image processing</i>. Amsterdam: Elsevier/Academic Press.</p> |
Revision as of 01:46, 18 September 2015