Openholo  beta 2.0
Open Source Digital Holographic Library

Functions

bool ophSig::sigConvertHPO ()
 Function for convert complex hologram to horizontal parallax only hologram . More...
 

Detailed Description

This module is related method which convert to horizontal parallax only hologram.

Introduction

Algorithm

Reference

Function Documentation

◆ sigConvertHPO()

bool ophSig::sigConvertHPO ( )

Function for convert complex hologram to horizontal parallax only hologram .

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

Definition at line 690 of file ophSig.cpp.

690  {
691  OphComplexField F1, G1, OUT_H;
692  int nx = context_.pixel_number[_X];
693  int ny = context_.pixel_number[_Y];
694  double y;
695  F1.resize(ny, nx);
696  G1.resize(ny, nx);
697  OUT_H.resize(ny, nx);
698  float NA = _width / (2 * _z);
699  float NA_g = NA*_redRate;
700  int i, j;
701  int xshift = nx / 2;
702  int yshift = ny / 2;
703  double temp = 0.;
704  double temp2 = 0.;
705  double sigmaf = (_z*(*context_.wave_length)) / (4 * M_PI);
706 
707  for (i = 0; i < ny; i++)
708  {
709  int ii = (i + yshift) % ny;
710  y = (2 * M_PI*(i) / _height - M_PI*(nx - 1) / _height);
711  temp = sigmaf*(y*y);
712  temp2 = ((-M_PI*(((*context_.wave_length) / (2 * M_PI*NA_g))*((*context_.wave_length) / (2 * M_PI*NA_g))))*((y*y)));
713  for (j = 0; j < nx; j++)
714  {
715  int jj = (j + xshift) % nx;
716  F1(ii, jj)._Val[_RE] = cos(temp);
717  F1(ii, jj)._Val[_IM] = sin(temp);
718  G1(ii, jj)._Val[_RE] = std::exp(temp2);
719  G1(ii, jj)._Val[_IM] = 0;
720  }
721  }
722  fft2(ComplexH[0], OUT_H, OPH_FORWARD);
723  G1.mulElem(F1.mulElem(OUT_H));
724  fft2(G1, ComplexH[0], OPH_BACKWARD);
725  return true;
726 }
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