Openholo  v2.1
Open Source Digital Holographic Library
ophSimulator.h
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 #ifndef __ophSimulator_h
47 #define __ophSimulator_h
48 
49 #define _USE_MATH_DEFINES
50 
51 #include "ophGen.h"
52 #include "ophPointCloud.h"
53 #include <vector>
54 
55 //Build Option : Multi Core Processing (OpenMP)
56 #ifdef _OPENMP
57 #include <omp.h>
58 #endif
59 
60 using namespace oph;
61 
62 class GEN_DLL ophSimulator : public ophGen
63 {
64 public:
69  explicit ophSimulator(void);
73 protected:
77  virtual ~ophSimulator(void);
78 
79 public:
80  int AddPoint(vec3 point, Real amplitude = 0.5);
81  int AddPoint(Real x, Real y, Real z, Real amplitude = 0.5);
82  int AddPlane(Real theta, Real phi);
83  bool SetResolution(ivec2 resolution);
84  bool SetResolution(int width, int height);
85  bool SetPixelPitch(vec2 size);
86  bool SetPixelPitch(Real width, Real height);
87  bool SetWaveLength(Real waveLength);
88  bool SetDistance(Real distance);
89  bool SetWaveNum(int nNum);
90  bool Save(char *path);
91  bool Encode(int option);
92  void Init();
93  bool GenerateHologram();
94  template<typename T>
95  void Normalize(T *src, uchar *dst, int width, int height);
96 
97 private:
98  ophPointCloud *m_pPointCloud;
99  uchar *m_pNormalize;
100  int m_nPoints;
101  int m_nPlanes;
102  Real m_distance;
103  vector<vec3> m_vecPoints;
104  vector<vec2> m_vecPlanes;
105  vector<Real> m_vecAmplitude;
106  bool m_bHasPoint;
107  bool m_bHasPlane;
108 };
109 
110 #endif // !__ophSimulator_h
unsigned char uchar
Definition: typedef.h:64
#define GEN_DLL
Definition: ophGen.h:54
Openholo Point Cloud based Compter-generated holography.
__managed__ float amplitude
Definition: ophPAS_GPU.cpp:28
float Real
Definition: typedef.h:55
Definition: Bitmap.h:49
Definition: ophGen.h:68