Openholo  v1.0
Open Source Digital Holographic Library
ophPointCloud.cpp
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install, copy or use the software.
7 //
8 //
9 // License Agreement
10 // For Open Source Digital Holographic Library
11 //
12 // Openholo library is free software;
13 // you can redistribute it and/or modify it under the terms of the BSD 2-Clause license.
14 //
15 // Copyright (C) 2017-2024, Korea Electronics Technology Institute. All rights reserved.
16 // E-mail : contact.openholo@gmail.com
17 // Web : http://www.openholo.org
18 //
19 // Redistribution and use in source and binary forms, with or without modification,
20 // are permitted provided that the following conditions are met:
21 //
22 // 1. Redistribution's of source code must retain the above copyright notice,
23 // this list of conditions and the following disclaimer.
24 //
25 // 2. Redistribution's in binary form must reproduce the above copyright notice,
26 // this list of conditions and the following disclaimer in the documentation
27 // and/or other materials provided with the distribution.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the copyright holder or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 // This software contains opensource software released under GNU Generic Public License,
41 // NVDIA Software License Agreement, or CUDA supplement to Software License Agreement.
42 // Check whether software you use contains licensed software.
43 //
44 //M*/
45 
46 #include "ophPointCloud.h"
47 #include "include.h"
48 
49 #include "tinyxml2.h"
50 #include <sys.h>
51 #include <cufft.h>
52 
54  : ophGen()
55  , is_CPU(true)
56  , is_ViewingWindow(false)
57  , n_percent(0)
58  , n_points(-1)
59 {
60 }
61 
62 ophPointCloud::ophPointCloud(const char* pc_file, const char* cfg_file)
63  : ophGen()
64  , is_CPU(true)
65  , is_ViewingWindow(false)
66  , n_percent(0)
67 {
68  n_points = loadPointCloud(pc_file);
69  if (n_points == -1) std::cerr << "OpenHolo Error : Failed to load Point Cloud Data File(*.dat)" << std::endl;
70 
71  bool b_read = readConfig(cfg_file);
72  if (!b_read) std::cerr << "OpenHolo Error : Failed to load Config Specification Data File(*.config)" << std::endl;
73 }
74 
76 {
77 }
78 
79 void ophPointCloud::setMode(bool is_CPU)
80 {
81  this->is_CPU = is_CPU;
82 }
83 
84 void ophPointCloud::setViewingWindow(bool is_ViewingWindow)
85 {
86  this->is_ViewingWindow = is_ViewingWindow;
87 }
88 
89 int ophPointCloud::loadPointCloud(const char* pc_file)
90 {
91  n_points = ophGen::loadPointCloud(pc_file, &pc_data_);
92 
93  return n_points;
94 }
95 
96 bool ophPointCloud::readConfig(const char* fname)
97 {
98  if (!ophGen::readConfig(fname))
99  return false;
100 
101  LOG("Reading....%s...", fname);
102 
103  auto start = CUR_TIME;
104 
105  using namespace tinyxml2;
106  /*XML parsing*/
107  tinyxml2::XMLDocument xml_doc;
108  XMLNode *xml_node;
109 
110  if (!checkExtension(fname, ".xml"))
111  {
112  LOG("file's extension is not 'xml'\n");
113  return false;
114  }
115  if (xml_doc.LoadFile(fname) != XML_SUCCESS)
116  {
117  LOG("Failed to load file \"%s\"\n", fname);
118  return false;
119  }
120 
121  xml_node = xml_doc.FirstChild();
122 
123  // about viewing window
124  auto next = xml_node->FirstChildElement("FieldLength");
125  if (!next || XML_SUCCESS != next->QueryDoubleText(&pc_config_.fieldLength))
126  return false;
127 
128  // about point
129  next = xml_node->FirstChildElement("ScaleX");
130  if (!next || XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[_X]))
131  return false;
132  next = xml_node->FirstChildElement("ScaleY");
133  if (!next || XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[_Y]))
134  return false;
135  next = xml_node->FirstChildElement("ScaleZ");
136  if (!next || XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[_Z]))
137  return false;
138  next = xml_node->FirstChildElement("OffsetInDepth");
139  if (!next || XML_SUCCESS != next->QueryDoubleText(&pc_config_.offset_depth))
140  return false;
141  next = xml_node->FirstChildElement("NumOfStream");
142  if (!next || XML_SUCCESS != next->QueryIntText(&pc_config_.n_streams))
143  return false;
144 
145  auto end = CUR_TIME;
146  auto during = ((chrono::duration<Real>)(end - start)).count();
147  LOG("%lf (s)..done\n", during);
148 
149  initialize();
150  return true;
151 }
152 
154 {
155  resetBuffer();
156  auto begin = CUR_TIME;
157  LOG("1) Algorithm Method : Point Cloud\n");
158  LOG("2) Generate Hologram with %s\n", is_CPU ?
159 #ifdef _OPENMP
160  "Multi Core CPU" :
161 #else
162  "Single Core CPU" :
163 #endif
164  "GPU");
165  LOG("3) Transform Viewing Window : %s\n", is_ViewingWindow ? "ON" : "OFF");
166  LOG("4) Diffraction Method : %s\n", diff_flag == PC_DIFF_RS ? "R-S" : "Fresnel");
167 
168  // Create CGH Fringe Pattern by 3D Point Cloud
169  if (is_CPU) { //Run CPU
170  genCghPointCloudCPU(diff_flag);
171  }
172  else { //Run GPU
173  genCghPointCloudGPU(diff_flag);
174  }
175 
176  n_percent = 0;
177  auto end = CUR_TIME;
178  elapsedTime = ((std::chrono::duration<Real>)(end - begin)).count();
179  LOG("Total Elapsed Time: %lf (s)\n", elapsedTime);
180  return elapsedTime;
181 }
182 
183 void ophPointCloud::encodeHologram(const vec2 band_limit, const vec2 spectrum_shift)
184 {
185  if (complex_H == nullptr) {
186  LOG("Not found diffracted data.");
187  return;
188  }
189 
190  LOG("Single Side Band Encoding..");
191  const uint nChannel = context_.waveNum;
192  const uint pnX = context_.pixel_number[_X];
193  const uint pnY = context_.pixel_number[_Y];
194  const Real ppX = context_.pixel_pitch[_X];
195  const Real ppY = context_.pixel_pitch[_Y];
196  const uint pnXY = pnX * pnY;
197 
198  encode_size = ivec2(pnX, pnY);
199  context_.ss[_X] = pnX * ppX;
200  context_.ss[_Y] = pnY * ppY;
201  vec2 ss = context_.ss;
202 
203  Real cropx = floor(pnX * band_limit[_X]);
204  Real cropx1 = cropx - floor(cropx / 2);
205  Real cropx2 = cropx1 + cropx - 1;
206 
207  Real cropy = floor(pnY * band_limit[_Y]);
208  Real cropy1 = cropy - floor(cropy / 2);
209  Real cropy2 = cropy1 + cropy - 1;
210 
211  Real* x_o = new Real[pnX];
212  Real* y_o = new Real[pnY];
213 
214  for (int i = 0; i < pnX; i++)
215  x_o[i] = (-ss[_X] / 2) + (ppX * i) + (ppX / 2);
216 
217  for (int i = 0; i < pnY; i++)
218  y_o[i] = (ss[_Y] - ppY) - (ppY * i);
219 
220  Real* xx_o = new Real[pnXY];
221  Real* yy_o = new Real[pnXY];
222 
223  for (int i = 0; i < pnXY; i++)
224  xx_o[i] = x_o[i % pnX];
225 
226 
227  for (int i = 0; i < pnX; i++)
228  for (int j = 0; j < pnY; j++)
229  yy_o[i + j * pnX] = y_o[j];
230 
231  Complex<Real>* h = new Complex<Real>[pnXY];
232 
233  for (uint ch = 0; ch < nChannel; ch++) {
234  fftwShift(complex_H[ch], h, pnX, pnY, OPH_FORWARD);
235  fft2(ivec2(pnX, pnY), h, OPH_FORWARD);
236  fftExecute(h);
237  fftwShift(h, h, pnX, pnY, OPH_BACKWARD);
238 
239  fftwShift(h, h, pnX, pnY, OPH_FORWARD);
240  fft2(ivec2(pnX, pnY), h, OPH_BACKWARD);
241  fftExecute(h);
242  fftwShift(h, h, pnX, pnY, OPH_BACKWARD);
243 
244  for (int i = 0; i < pnXY; i++) {
245  Complex<Real> shift_phase(1.0, 0.0);
246  int r = i / pnX;
247  int c = i % pnX;
248 
249  Real X = (M_PI * xx_o[i] * spectrum_shift[_X]) / ppX;
250  Real Y = (M_PI * yy_o[i] * spectrum_shift[_Y]) / ppY;
251 
252  shift_phase[_RE] = shift_phase[_RE] * (cos(X) * cos(Y) - sin(X) * sin(Y));
253 
254  holo_encoded[ch][i] = (h[i] * shift_phase).real();
255  }
256  }
257  delete[] h;
258  delete[] x_o;
259  delete[] xx_o;
260  delete[] y_o;
261  delete[] yy_o;
262 
263  LOG("Done.\n");
264 }
265 
267 {
269 }
270 
271 void ophPointCloud::encoding(unsigned int ENCODE_FLAG, unsigned int SSB_PASSBAND)
272 {
275 }
276 
277 void ophPointCloud::transVW(int nSize, Real *dst, Real *src)
278 {
279  Real fieldLens = this->getFieldLens();
280  //memcpy(dst, src, sizeof(Real) * nSize);
281  for (int i = 0; i < nSize; i++) {
282  *(dst + i) = -fieldLens * src[i] / (src[i] - fieldLens);
283  }
284 }
285 
286 Real ophPointCloud::genCghPointCloudCPU(uint diff_flag)
287 {
288  auto begin = CUR_TIME;
289 
290  // Output Image Size
291  ivec2 pn;
292  pn[_X] = context_.pixel_number[_X];
293  pn[_Y] = context_.pixel_number[_Y];
294 
295  // Tilt Angle
296  Real thetaX = RADIAN(pc_config_.tilt_angle[_X]);
297  Real thetaY = RADIAN(pc_config_.tilt_angle[_Y]);
298 
299  // Pixel pitch at eyepiece lens plane (by simple magnification) ==> SLM pitch
300  vec2 pp;
301  pp[_X] = context_.pixel_pitch[_X];
302  pp[_Y] = context_.pixel_pitch[_Y];
303 
304  // Length (Width) of complex field at eyepiece plane (by simple magnification)
305  vec2 ss;
306  ss[_X] = context_.ss[_X] = pn[_X] * pp[_X];
307  ss[_Y] = context_.ss[_Y] = pn[_Y] * pp[_Y];
308 
309  uint nChannel = context_.waveNum;
310 
311 
312 
313  int i; // private variable for Multi Threading
314  int num_threads = 1;
315 
316 
317  int sum = 0;
318  int prev = 0;
319  n_percent = 0;
320 
321  for (uint ch = 0; ch < nChannel; ++ch) {
322  // Wave Number (2 * PI / lambda(wavelength))
323  Real lambda = context_.wave_length[ch];
324  Real k = context_.k = (2 * M_PI / lambda);
325 #ifdef _OPENMP
326 #pragma omp parallel
327  {
328  num_threads = omp_get_num_threads(); // get number of Multi Threading
329  int tid = omp_get_thread_num();
330 
331 #pragma omp for private(i)
332 #endif
333  for (i = 0; i < n_points; ++i) { //Create Fringe Pattern
334  uint idx = 3 * i;
335  uint color_idx = pc_data_.n_colors * i;
336  Real pcx = (is_ViewingWindow) ? transVW(pc_data_.vertex[idx + _X]) : pc_data_.vertex[idx + _X];
337  Real pcy = (is_ViewingWindow) ? transVW(pc_data_.vertex[idx + _Y]) : pc_data_.vertex[idx + _Y];
338  Real pcz = (is_ViewingWindow) ? transVW(pc_data_.vertex[idx + _Z]) : pc_data_.vertex[idx + _Z];
339  pcx *= pc_config_.scale[_X];
340  pcy *= pc_config_.scale[_Y];
341  pcz *= pc_config_.scale[_Z];
342  pcz += pc_config_.offset_depth;
343  Real amplitude = pc_data_.color[color_idx];
344 
345  switch (diff_flag)
346  {
347  case PC_DIFF_RS:
348  diffractNotEncodedRS(ch, pn, pp, ss, vec3(pcx, pcy, pcz), k, amplitude, lambda);
349  break;
350  case PC_DIFF_FRESNEL:
351  diffractNotEncodedFrsn(ch, pn, pp, ss, vec3(pcx, pcy, pcz), k, amplitude, lambda);
352  break;
353  }
354 #pragma omp atomic
355  sum ++;
356 
357  n_percent = (int)((Real)sum * 100 / ((Real)n_points * nChannel));
358  }
359 #ifdef _OPENMP
360  }
361 #endif
362  }
363 
364  auto end = CUR_TIME;
365  Real elapsed_time = ((chrono::duration<Real>)(end - begin)).count();
366  LOG("\n%s : %lf(s) <%d threads>\n\n",
367  __FUNCTION__,
368  elapsed_time,
369  num_threads);
370 
371  return elapsed_time;
372 }
373 
374 void ophPointCloud::diffractEncodedRS(uint channel, ivec2 pn, vec2 pp, vec2 ss, vec3 pc, Real k, Real amplitude, vec2 theta)
375 {
376  for (int yytr = 0; yytr < pn[_Y]; ++yytr)
377  {
378  for (int xxtr = 0; xxtr < pn[_X]; ++xxtr)
379  {
380  Real xxx = ((Real)xxtr + 0.5) * pp[_X] - (ss[_X] / 2);
381  Real yyy = (ss[_Y] / 2) - ((Real)yytr + 0.5) * pp[_Y];
382 
383  Real r = sqrt((xxx - pc[_X]) * (xxx - pc[_X]) + (yyy - pc[_Y]) * (yyy - pc[_Y]) + (pc[_Z] * pc[_Z]));
384  Real p = k * (r - xxx * sin(theta[_X]) - yyy * sin(theta[_Y]));
385  Real res = amplitude * cos(p);
386 
387  holo_encoded[channel][xxtr + yytr * pn[_X]] += res;
388  }
389  }
390 }
391 
392 void ophPointCloud::diffractNotEncodedRS(uint channel, ivec2 pn, vec2 pp, vec2 ss, vec3 pc, Real k, Real amplitude, Real lambda)
393 {
394  // for performance
395  Real tx = lambda / (2 * pp[_X]);
396  Real ty = lambda / (2 * pp[_Y]);
397  Real sqrtX = sqrt(1 - (tx * tx));
398  Real sqrtY = sqrt(1 - (ty * ty));
399  Real x = -ss[_X] / 2;
400  Real y = -ss[_Y] / 2;
401  Real zz = pc[_Z] * pc[_Z];
402  Real ampZ = amplitude * pc[_Z];
403 
404  Real _xbound[2] = {
405  pc[_X] + abs(tx / sqrtX * pc[_Z]),
406  pc[_X] - abs(tx / sqrtX * pc[_Z])
407  };
408 
409  Real _ybound[2] = {
410  pc[_Y] + abs(ty / sqrtY * pc[_Z]),
411  pc[_Y] - abs(ty / sqrtY * pc[_Z])
412  };
413 
414  Real Xbound[2] = {
415  floor((_xbound[_X] - x) / pp[_X]) + 1,
416  floor((_xbound[_Y] - x) / pp[_X]) + 1
417  };
418 
419  Real Ybound[2] = {
420  pn[_Y] - floor((_ybound[_Y] - y) / pp[_Y]),
421  pn[_Y] - floor((_ybound[_X] - y) / pp[_Y])
422  };
423 
424  if (Xbound[_X] > pn[_X]) Xbound[_X] = pn[_X];
425  if (Xbound[_Y] < 0) Xbound[_Y] = 0;
426  if (Ybound[_X] > pn[_Y]) Ybound[_X] = pn[_Y];
427  if (Ybound[_Y] < 0) Ybound[_Y] = 0;
428 
429 
430  for (int yytr = Ybound[_Y]; yytr < Ybound[_X]; ++yytr)
431  {
432  int offset = yytr * pn[_X];
433  Real yyy = y + ((pn[_Y] - yytr) * pp[_Y]);
434 
435  Real range_x[2] = {
436  pc[_X] + abs(tx / sqrtX * sqrt((yyy - pc[_Y]) * (yyy - pc[_Y]) + zz)),
437  pc[_X] - abs(tx / sqrtX * sqrt((yyy - pc[_Y]) * (yyy - pc[_Y]) + zz))
438  };
439 
440  for (int xxtr = Xbound[_Y]; xxtr < Xbound[_X]; ++xxtr)
441  {
442  Real xxx = x + ((xxtr - 1) * pp[_X]);
443  Real r = sqrt((xxx - pc[_X]) * (xxx - pc[_X]) + (yyy - pc[_Y]) * (yyy - pc[_Y]) + zz);
444  Real range_y[2] = {
445  pc[_Y] + abs(ty / sqrtY * sqrt((xxx - pc[_X]) * (xxx - pc[_X]) + zz)),
446  pc[_Y] - abs(ty / sqrtY * sqrt((xxx - pc[_X]) * (xxx - pc[_X]) + zz))
447  };
448 
449  if (((xxx < range_x[_X]) && (xxx > range_x[_Y])) && ((yyy < range_y[_X]) && (yyy > range_y[_Y]))) {
450  // int idx = (flag) ? pn[_X] * i + j : pn[_Y] * j + i;
451  Real kr = k * r;
452  Real operand = lambda * r * r;
453  Real res_real = (ampZ * sin(kr)) / operand;
454  Real res_imag = (-ampZ * cos(kr)) / operand;
455 #ifdef _OPENMP
456 #pragma omp atomic
457  complex_H[channel][offset + xxtr][_RE] += res_real;
458 #pragma omp atomic
459  complex_H[channel][offset + xxtr][_IM] += res_imag;
460 #else
461 
462  complex_H[channel][offset + xxtr][_RE] += res_real;
463  complex_H[channel][offset + xxtr][_IM] += res_imag;
464 #endif
465  }
466  }
467  }
468 }
469 
470 void ophPointCloud::diffractEncodedFrsn(void)
471 {
472 }
473 
474 void ophPointCloud::diffractNotEncodedFrsn(uint channel, ivec2 pn, vec2 pp, vec2 ss, vec3 pc, Real k, Real amplitude, Real lambda)
475 {
476  // for performance
477  Real x = -ss[_X] / 2;
478  Real y = -ss[_Y] / 2;
479  Real operand = lambda * pc[_Z];
480 
481  Real _xbound[2] = {
482  pc[_X] + abs(operand / (2 * pp[_X])),
483  pc[_X] - abs(operand / (2 * pp[_X]))
484  };
485 
486  Real _ybound[2] = {
487  pc[_Y] + abs(operand / (2 * pp[_Y])),
488  pc[_Y] - abs(operand / (2 * pp[_Y]))
489  };
490 
491  Real Xbound[2] = {
492  floor((_xbound[_X] - x) / pp[_X]) + 1,
493  floor((_xbound[_Y] - x) / pp[_X]) + 1
494  };
495 
496  Real Ybound[2] = {
497  pn[_Y] - floor((_ybound[_Y] - y) / pp[_Y]),
498  pn[_Y] - floor((_ybound[_X] - y) / pp[_Y])
499  };
500 
501  if (Xbound[_X] > pn[_X]) Xbound[_X] = pn[_X];
502  if (Xbound[_Y] < 0) Xbound[_Y] = 0;
503  if (Ybound[_X] > pn[_Y]) Ybound[_X] = pn[_Y];
504  if (Ybound[_Y] < 0) Ybound[_Y] = 0;
505 
506  for (int yytr = Ybound[_Y]; yytr < Ybound[_X]; ++yytr)
507  {
508  Real yyy = (y + (pn[_Y] - yytr) * pp[_Y]) - pc[_Y];
509  int offset = yytr * pn[_X];
510  for (int xxtr = Xbound[_Y]; xxtr < Xbound[_X]; ++xxtr)
511  {
512  Real xxx = (x + (xxtr - 1) * pp[_X]) - pc[_X];
513  Real p = k * (xxx * xxx + yyy * yyy + 2 * pc[_Z] * pc[_Z]) / (2 * pc[_Z]);
514 
515  Real res_real = amplitude * sin(p) / operand;
516  Real res_imag = amplitude * (-cos(p)) / operand;
517 
518 #ifdef _OPENMP
519 #pragma omp atomic
520  complex_H[channel][offset + xxtr][_RE] += res_real;
521 #pragma omp atomic
522  complex_H[channel][offset + xxtr][_IM] += res_imag;
523 #else
524  complex_H[channel][offset + xxtr][_RE] += res_real;
525  complex_H[channel][offset + xxtr][_IM] += res_imag;
526 #endif
527  }
528  }
529 }
530 
531 void ophPointCloud::ophFree(void)
532 {
533  delete[] pc_data_.vertex;
534  delete[] pc_data_.color;
535  delete[] pc_data_.phase;
536 }
#define OPH_BACKWARD
Definition: define.h:67
ENCODE_FLAG
Definition: ophGen.h:72
void abs(const oph::Complex< T > &src, oph::Complex< T > &dst)
Definition: function.h:112
Real * vertex
Geometry of point clouds.
Definition: ophGen.h:433
Real offset_depth
Offset value of point cloud.
Definition: ophGen.h:404
Real * color
Color data of point clouds.
Definition: ophGen.h:435
Real k
Definition: Openholo.h:66
Real * wave_length
Definition: Openholo.h:69
SSB_PASSBAND
Definition: ophGen.h:227
vec2 tilt_angle
Tilt angle for spatial filtering.
Definition: ophGen.h:416
float Real
Definition: typedef.h:55
void initialize(void)
Initialize variables for Hologram complex field, encoded data, normalized data.
Definition: ophGen.cpp:69
#define CUR_TIME
Definition: function.h:58
vec2 ss
Definition: Openholo.h:67
bool checkExtension(const char *fname, const char *ext)
Functions for extension checking.
Definition: Openholo.cpp:80
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:761
void encodeHologram(vec2 band_limit=vec2(0.8, 0.5), vec2 spectrum_shift=vec2(0.0, 0.5))
encode Single-side band
Real elapsedTime
Elapsed time of generate hologram.
Definition: ophGen.h:246
#define _Y
Definition: define.h:84
#define _IM
Definition: complex.h:57
vec3 scale
Scaling factor of coordinate of point cloud.
Definition: ophGen.h:402
#define _X
Definition: define.h:80
int loadPointCloud(const char *pc_file)
override
ivec2 encode_size
Encoded hologram size, varied from encoding type.
Definition: ophGen.h:240
bool readConfig(const char *cfg_file)
Import Specification Config File(*.config) file.
Real ** holo_encoded
buffer to encoded.
Definition: ophGen.h:248
#define RADIAN(theta)
Definition: define.h:60
oph::ivec2 pixel_number
Definition: Openholo.h:63
virtual ~ophPointCloud(void)
Destructor.
#define _RE
Definition: complex.h:54
Real getFieldLens(void)
Directly Get Basic Data.
void fft2(ivec2 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
Functions for performing fftw 2-dimension operations inside Openholo.
Definition: Openholo.cpp:416
ophPointCloud(void)
Constructor.
void setViewingWindow(bool is_ViewingWindow)
Set the value of a variable is_ViewingWindow(true or false)
void setMode(bool is_CPU)
Set the value of a variable is_CPU(true or false)
uint waveNum
Definition: Openholo.h:68
int n_colors
Number of color channel.
Definition: ophGen.h:431
bool readConfig(const char *fname)
load to configuration file.
Definition: ophGen.cpp:150
XMLError LoadFile(const char *filename)
Definition: tinyxml2.cpp:2157
void fftExecute(Complex< Real > *out)
Execution functions to be called after fft1, fft2, and fft3.
Definition: Openholo.cpp:487
void encoding()
Definition: ophGen.cpp:525
void resetBuffer()
reset buffer
Definition: ophGen.cpp:363
void fftwShift(Complex< Real > *src, Complex< Real > *dst, int nx, int ny, int type, bool bNormalized=false)
Convert data from the spatial domain to the frequency domain using 2D FFT on CPU. ...
Definition: Openholo.cpp:530
OphConfig context_
Definition: Openholo.h:297
#define OPH_FORWARD
Definition: define.h:66
Complex< Real > ** complex_H
Definition: Openholo.h:298
Real generateHologram(uint diff_flag=PC_DIFF_RS)
Generate a hologram, main funtion.
#define _Z
Definition: define.h:88
Real sum(const vec2 &a)
Definition: vec.h:401
int loadPointCloud(const char *pc_file, OphPointCloudData *pc_data_)
load to point cloud data.
Definition: ophGen.cpp:133
const XMLElement * FirstChildElement(const char *name=0) const
Definition: tinyxml2.cpp:940
unsigned int uint
Definition: typedef.h:62
#define M_PI
Definition: define.h:52
Definition: ophGen.h:68
Real * phase
Phase value of point clouds.
Definition: ophGen.h:437
oph::vec2 pixel_pitch
Definition: Openholo.h:64