User Tools

Site Tools


macro:brenner_gradient

Brenner Gradient

A macro to determine image focal quality image-wide (not ROI-wide)

BrennerGradient.txt
// A macro to determine image focal quality image-wide (not ROI-wide)
// Based on algorithm F-3 "Brenner Gradient"
// In: Sun et al., 2004. MICROSCOPY RESEARCH AND TECHNIQUE 65, 139–149.
// 
// Version: 0.1
// Date: 14/07/2006
// Author: Andy Weller
 
macro "Brenner_Gradient" {
W = getWidth();
H = getHeight();
brenner = 0; // Set to 0 which is out of focus
for (j=0; j<H; j++) {
   for (i=0; i<W; i++) {
      p = getPixel(i,j);
      p1 = getPixel(i+2,j);
      brenner += (p1-p)*(p1-p); // Maximum value is best-focused, decreasing as defocus increases
      }
   }
print(brenner); // This can also (should) be changed to return(brenner)
}

by Andy Weller — last modified 2006-07-14 20:58

macro/brenner_gradient.txt · Last modified: 2019/04/12 13:13 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki