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

Algorithm

Reference

Function Documentation

◆ sigGetParamSF()

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

Extraction of distance parameter using sharpness functions .

Parameters
zMaxmaximum value of distance on z axis
zMinminimum value of distance on z axis
sampNcount of search step
ththreshold 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[0], -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[0] - I(i, j)._Val[0]);
1014  ret2 = abs(I(i, j + 2)._Val[0] - I(i, j)._Val[0]);
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