observation about C++ autofocus algorithmt

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

observation about C++ autofocus algorithmt

Hoover, Karl
Hi Nico,

I was intrigued by the user's observation about the auto focus performance. I took a look at the SimpleAF code and indeed I believe it could be faster. What I understand is that the image region is first filtered for noise with a median filter and then evaluated for sharpness with a Laplacian. The median noise filter is probably the slowest part. The running time for an  NxN image and 3x3 median and sharpness kernels will be proportional to N*N*9*ln(9)  (the median filter)  + N*N*9 (the sharpness filter) or about N*N*27. Perhaps the noise and sharpness filters can be combined into one convolver kernel, if this is still a  3x3 the calculation time would be reduced to N*N*9, even a 5x5 kernel could run in time  N*N*25

Karl



________________________________________
From: Nico Stuurman [[hidden email]]
Sent: Friday, February 12, 2010 12:47
To: Micro-Manager General
Subject: Re: [micro-manager-general] Setting autofocus parameters from  within a script

> What is the difference between fullFocus() and incrementalFocus()? I tried
> both and gave similar results.

The idea is that incrementalFocus will only look at a small range of z-values, whereas fullFocus will do the whole range, however, the implementation depends on the specific Autofocus adapter that you use.

There are currently 3 Java-based autofocus adapters ( JAF(H&P), JAF(TB), Duo), and at least one C++ based autofocus adapter (SimpleAF, you have to add this one using the Hardware Configuration Wizard), so it is really useful to know which one you are talking about, and you might want to try some of the others to see if they work better.  Also, please feel free to look at the code of these and propose improvements.

Best,

Nico
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: observation about C++ autofocus algorithmt

Prashanth Ravindran-2
Hi Karl-

I was the guy who wrote the simple AF device and this was my thinking behind having separate median filtering and laplacian scoring.

1.  When  doing image based autofocus, it is best to have as short exposures as possible.
2.  When doing short exposures in fluorescence we get shot noise/ salt and pepper noise, not so much gaussian noise
3. Filtering by convolution methods tend to re-distribute the pixels and bring down the overall sharpness of the image, which is the metric that we want to score for anyway.

The median filtering was mostly introduced for the case where the flourophore is bleached and there is lot of shot noise as I was seeing with my samples. My suggestion for fixing this problem, is to define a property that will enable/ disable median filtering based on the user input.

Thanks,
-- Prashanth

P.S: This is just for the record. If you feel that it is best to go ahead and implement a convolution based filtering please go ahead and do so.



On Fri, Feb 12, 2010 at 6:30 PM, Hoover, Karl <[hidden email]> wrote:
Hi Nico,

I was intrigued by the user's observation about the auto focus performance. I took a look at the SimpleAF code and indeed I believe it could be faster. What I understand is that the image region is first filtered for noise with a median filter and then evaluated for sharpness with a Laplacian. The median noise filter is probably the slowest part. The running time for an  NxN image and 3x3 median and sharpness kernels will be proportional to N*N*9*ln(9)  (the median filter)  + N*N*9 (the sharpness filter) or about N*N*27. Perhaps the noise and sharpness filters can be combined into one convolver kernel, if this is still a  3x3 the calculation time would be reduced to N*N*9, even a 5x5 kernel could run in time  N*N*25

Karl



________________________________________
From: Nico Stuurman [[hidden email]]
Sent: Friday, February 12, 2010 12:47
To: Micro-Manager General
Subject: Re: [micro-manager-general] Setting autofocus parameters from  within a script

> What is the difference between fullFocus() and incrementalFocus()? I tried
> both and gave similar results.

The idea is that incrementalFocus will only look at a small range of z-values, whereas fullFocus will do the whole range, however, the implementation depends on the specific Autofocus adapter that you use.

There are currently 3 Java-based autofocus adapters ( JAF(H&P), JAF(TB), Duo), and at least one C++ based autofocus adapter (SimpleAF, you have to add this one using the Hardware Configuration Wizard), so it is really useful to know which one you are talking about, and you might want to try some of the others to see if they work better.  Also, please feel free to look at the code of these and propose improvements.

Best,

Nico
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general



--
Thanks,
-- Prashanth

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general