Openholo  beta 2.0
Open Source Digital Holographic Library

Functions

bool ophSig::sigConvertCAC (double red, double green, double blue)
 Function for Chromatic aberration compensation filter . More...
 

Detailed Description

This module is related method which compensate of full color hologram with chromatic aberration.

Introduction

Algorithm

Reference

Function Documentation

◆ sigConvertCAC()

bool ophSig::sigConvertCAC ( double  red,
double  green,
double  blue 
)

Function for Chromatic aberration compensation filter .

Returns
if works well return 0 or error occurs return -1

Definition at line 728 of file ophSig.cpp.

728  {
729 
730  Real x, y;
731  OphComplexField FFZP, exp, FH, conj, FH_CAC;
732  int nx = context_.pixel_number[_X];
733  int ny = context_.pixel_number[_Y];
734 
735  if (_wavelength_num != 3) {
736  _wavelength_num = 3;
737  delete[] context_.wave_length;
738  context_.wave_length = new Real[_wavelength_num];
739  }
740 
741  context_.wave_length[0] = blue;
742  context_.wave_length[1] = green;
743  context_.wave_length[2] = red;
744 
745  FFZP.resize(nx, ny);
746  FH.resize(nx, ny);
747 
748  for (int z = 0; z < _wavelength_num; z++)
749  {
750  double sigmaf = ((_foc[2] - _foc[z]) * context_.wave_length[z]) / (4 * M_PI);
751  int xshift = nx / 2;
752  int yshift = ny / 2;
753  double temp = 0.;
754 
755  for (int i = 0; i < ny; i++)
756  {
757  int ii = (i + yshift) % ny;
758  for (int j = 0; j < nx; j++)
759  {
760  x = 2 * M_PI * j / _radius - M_PI*(nx - 1) / _radius;
761  y = 2 * M_PI * i / _radius - M_PI*(ny - 1) / _radius;
762  int jj = (j + xshift) % nx;
763  temp = sigmaf * ((x * x + y * y));
764  FFZP(ii, jj)._Val[_RE] = cos(temp);
765  FFZP(ii, jj)._Val[_IM] = -sin(temp);
766  }
767  }
768  fft2(ComplexH[z], FH, OPH_FORWARD);
769  FH.mulElem(FFZP);
770  fft2(FH, ComplexH[z], OPH_BACKWARD);
771  }
772  return true;
773 }
void fft2(matrix< Complex< T >> &src, matrix< Complex< T >> &dst, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
Function for Fast Fourier transform 2D.
Definition: ophSig.cpp:226