 Openholo  beta 2.0 Open Source Digital Holographic Library
Get Parameter-SF

## Functions

double ophSig::sigGetParamSF (float zMax, float zMin, int sampN, float th)
Extraction of distance parameter using sharpness functions . More...

## Detailed Description

This module is related method which extraction of distance parameter using sharpness function maximization method.

# Introduction

• We use autofocusing to capture in-focus images. It is based on sharpness of images and various of autofocusing algorithms have been proposed. It represents a peak when the image is in-focus and drops when the image goes out-of-focus. It can relate to holography signal process. Hologram has a depth information of object and is reconstructed at that point. The sharpness of the reconstructed hologram image changes with the change of the depth position.
• If the depth of focus is not correct, the reconstructed hologram can not have a clear image. It means the same as in-focus image phenomenon. For this reasons, we will discuss the hologram signal processing using the sharpness functions.

# Algorithm

• Brenner function  : A focus function f(Z) is calculated which is a measure of the average change in gray level between pairs of points separated by n pixels. f(Z) is a maximum when the image is in focus. and is given by

$f(Z)=\sum_{j}\sum_{i}\left| G_i(Z)-G_{ij}(Z)\right|^2$

• Where the index (i) ranges over all image points, in order along a scan line (j); n is a small integer; Z is the Z-axis, or focus position; and $$G_i$$ is the transmission gray level for point i. A value of n equal to 2 gives a good signal to noise ratio. Figure 1. Concept of searching distance parameter.
• Reconstruct the hologram to sequential depth positions using Fresnel diffraction method. then we can obtain $$f(Z)$$ of reconstructed hologram image. if $$f(Z)$$ is maximum value, value of $$Z$$ is distance parameter of hologram.

# Reference

•  J. Brenner et al., "An Automated Microscope for Cytologic Research - A Preliminary Evaluation", Journal of Histochemistry and Cytochemistry, vol. 24, no. 1, pp. 100-111, 1976

## ◆ sigGetParamSF()

 double ophSig::sigGetParamSF ( float zMax, float zMin, int sampN, float th )

Extraction of distance parameter using sharpness functions .

Parameters
 zMax maximum value of distance on z axis zMin minimum value of distance on z axis sampN count of search step th threshold value
Returns
result distance

Definition at line 987 of file ophSig.cpp.

987  {
988
989  int nx = context_.pixel_number[_X];
990  int ny = context_.pixel_number[_Y];
991
992  OphComplexField I(nx, ny);
993  vector<Real> F;
994  Real dz = (zMax - zMin) / sampN;
995  Real f;
996  Real_t z = 0;
997  Real depth = 0;
998  Real max = MIN_DOUBLE;
999  int i, j, n = 0;
1000  Real ret1;
1001  Real ret2;
1002
1003  for (n = 0; n < sampN + 1; n++)
1004  {
1005  z = ((n)* dz + zMin);
1006  f = 0;
1007  I = propagationHolo(ComplexH, -z);
1008
1009  for (i = 0; i < nx - 2; i++)
1010  {
1011  for (j = 0; j < ny - 2; j++)
1012  {
1013  ret1 = abs(I(i + 2, j)._Val - I(i, j)._Val);
1014  ret2 = abs(I(i, j + 2)._Val - I(i, j)._Val);
1015  if (ret1 >= th) { f += ret1 * ret1; }
1016  else if (ret2 >= th) { f += ret2 * ret2; }
1017  }
1018  }
1019  cout << (float)n / sampN * 100 << " %" << endl;
1020
1021  if (f > max) {
1022  max = f;
1023  depth = z;
1024  }
1025  }
1026
1027  return depth;
1028 }
bool propagationHolo(float depth)
Function for Chromatic aberration compensation filter.
Definition: ophSig.cpp:820