Re: Autofocusing and image grey level mean
Posted by Gabriel Landini on Jun 14, 2006; 4:43pm
URL: http://imagej.273.s1.nabble.com/Autofocusing-and-image-grey-level-mean-tp3702505p3702506.html
On Wednesday 14 June 2006 16:03, Andy Weller wrote:
> My interpretation of the algorithm is as follows (please tell me if I am
> wrong?!?):
>
> a = 1 / ([image height] x [image width] x [image grey level mean
> intensity])
>
> b = ([pixel grey level] - [image grey level mean intensity])^2
>
> Normalized Variance = a x b
Not sure you mean what you wrote. b is calculated over a HxW window (or ROI),
so the variance is extracted from that window.
You have to accumulate the squared differences of each pixel in the window
with the mean intensity of the window. The sum of all that is b.
The focus is found when the variance is the largest, but this will not work
very well with noisy images.
I hope it helps,
G.