Openholo  v2.1
Open Source Digital Holographic Library
ophACPAS.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef __ophACPAS_h
4 #define __ophACPAS_h
5 
6 #include "ophGen.h"
7 
8 
9 #define PI (3.14159265358979323846f)
10 #define M2_PI (PI*2.0)
11 #define RADIANS (PI/180.0) // Angle in radians
12 // DEGREE*asin(mytheta)
13 #define DEGREE2 (180./PI) // sin(RADIANS*DEGREE*asin(mytheta))
14 
15 #define NUMTBL 1024
16 #define NUMTBL2 (NUMTBL-1)
17 #define MAX_STR_LEN 4000
18 
19 struct VoxelStruct;
20 struct CGHEnvironmentData;
21 struct Segment;
22 
23 #define FFT_SEG_SIZE 64
24 #define SEG_SIZE 8
25 
26 using namespace oph;
27 
28 class GEN_DLL ophACPAS : public ophGen
29 {
30 public:
31  explicit ophACPAS();
32 protected:
33  virtual ~ophACPAS();
34 
35 public:
36  int init(const char* _filename, CGHEnvironmentData* _CGHE); // ÃʱâÈ­
37 
38  bool loadConfig(const char* filename, CGHEnvironmentData* _CGHE);
39  bool readConfig(const char* fname, OphPointCloudConfig& configdata);
40  bool loadPoint(const char* _filename, VoxelStruct* h_vox);
41  bool load_Num_Point(const char* _filename, long* num_point);
42  //int saveAsImg(const char * fname, uint8_t bitsperpixel, void* src, int pic_width, int pic_height); // À̹ÌÁö ÀúÀå
43  int save(const char * fname, uint8_t bitsperpixel, uchar* src, uint px, uint py);
44 
45  //util
46  char* trim(char *s); // ¹®ÀÚ¿­ ÁÂ¿ì °ø¹é ¸ðµÎ »èÁ¦ ÇÔ¼ö char* ltrim(char *s); // ¹®ÀÚ¿­ ÁÂÃø °ø¹é Á¦°Å ÇÔ¼ö char* rtrim(char* s); // ¹®ÀÚ¿­ ¿ìÃø °ø¹é Á¦°Å ÇÔ¼ö void DataInit(CGHEnvironmentData* _CGHE); //µ¥ÀÌÅÍ ÃʱâÈ­ void DataInit(OphPointCloudConfig& conf); int ACPASCalcuation(long voxnum, unsigned char *cghfringe, VoxelStruct* h_vox, CGHEnvironmentData* _CGHE); // ÆÐÅÏ°è»ê int ACPASCalcuation(long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf); // ÆÐÅÏ°è»ê void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE); void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf); double *m_pHologram; float m_COStbl[NUMTBL]; float m_SINtbl[NUMTBL]; int m_segSize; int m_hsegSize; int m_dsegSize; int m_segNumx; int m_segNumy; int m_hsegNumx; int m_hsegNumy; float *m_SFrequency_cx; float *m_SFrequency_cy; int *m_PickPoint_cx; int *m_PickPoint_cy; int *m_Coefficient_cx; int *m_Coefficient_cy; float *m_xc; float *m_yc; float m_sf_base; fftw_complex *m_in, *m_out; fftw_plan m_plan; float **m_inRe; float **m_inIm; float m_cx; float m_cy; float m_cz; float m_amp; }; struct GEN_DLL VoxelStruct // voxel structure - data { int num; // voxel or point number float x; // x axis coordinate float y; // y axis coordinate float z; // z axis coordinate float ph; // phase float r; // amplitude in red channel //float g; // amplitude in green channel //float b; // amplitude in blue channel }; struct GEN_DLL CGHEnvironmentData { int CghWidth; // cgh width int CghHeight; // cgh height int SegmentationSize; int fftSegmentationSize; float rWaveLength; // red laser lambda float rWaveNumber; // red laser lambda float ThetaX; float ThetaY; float DefaultDepth; float xInterval; float yInterval; float xiInterval; float etaInterval; float CGHScale; }; struct GEN_DLL Segment { bool WorkingFlag; long SegmentIndex; int SegSize_x; int SegSize_y; int hSegSize_x; // Half size int hSegSize_y; // Half size double CenterX; double CenterY; double FrequencySlope; }; #endif // !__ophPAS_h
47  char* ltrim(char *s); // ¹®ÀÚ¿­ ÁÂÃø °ø¹é Á¦°Å ÇÔ¼ö char* rtrim(char* s); // ¹®ÀÚ¿­ ¿ìÃø °ø¹é Á¦°Å ÇÔ¼ö void DataInit(CGHEnvironmentData* _CGHE); //µ¥ÀÌÅÍ ÃʱâÈ­ void DataInit(OphPointCloudConfig& conf); int ACPASCalcuation(long voxnum, unsigned char *cghfringe, VoxelStruct* h_vox, CGHEnvironmentData* _CGHE); // ÆÐÅÏ°è»ê int ACPASCalcuation(long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf); // ÆÐÅÏ°è»ê void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE); void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf); double *m_pHologram; float m_COStbl[NUMTBL]; float m_SINtbl[NUMTBL]; int m_segSize; int m_hsegSize; int m_dsegSize; int m_segNumx; int m_segNumy; int m_hsegNumx; int m_hsegNumy; float *m_SFrequency_cx; float *m_SFrequency_cy; int *m_PickPoint_cx; int *m_PickPoint_cy; int *m_Coefficient_cx; int *m_Coefficient_cy; float *m_xc; float *m_yc; float m_sf_base; fftw_complex *m_in, *m_out; fftw_plan m_plan; float **m_inRe; float **m_inIm; float m_cx; float m_cy; float m_cz; float m_amp; }; struct GEN_DLL VoxelStruct // voxel structure - data { int num; // voxel or point number float x; // x axis coordinate float y; // y axis coordinate float z; // z axis coordinate float ph; // phase float r; // amplitude in red channel //float g; // amplitude in green channel //float b; // amplitude in blue channel }; struct GEN_DLL CGHEnvironmentData { int CghWidth; // cgh width int CghHeight; // cgh height int SegmentationSize; int fftSegmentationSize; float rWaveLength; // red laser lambda float rWaveNumber; // red laser lambda float ThetaX; float ThetaY; float DefaultDepth; float xInterval; float yInterval; float xiInterval; float etaInterval; float CGHScale; }; struct GEN_DLL Segment { bool WorkingFlag; long SegmentIndex; int SegSize_x; int SegSize_y; int hSegSize_x; // Half size int hSegSize_y; // Half size double CenterX; double CenterY; double FrequencySlope; }; #endif // !__ophPAS_h
48  char* rtrim(char* s); // ¹®ÀÚ¿­ ¿ìÃø °ø¹é Á¦°Å ÇÔ¼ö void DataInit(CGHEnvironmentData* _CGHE); //µ¥ÀÌÅÍ ÃʱâÈ­ void DataInit(OphPointCloudConfig& conf); int ACPASCalcuation(long voxnum, unsigned char *cghfringe, VoxelStruct* h_vox, CGHEnvironmentData* _CGHE); // ÆÐÅÏ°è»ê int ACPASCalcuation(long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf); // ÆÐÅÏ°è»ê void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE); void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf); double *m_pHologram; float m_COStbl[NUMTBL]; float m_SINtbl[NUMTBL]; int m_segSize; int m_hsegSize; int m_dsegSize; int m_segNumx; int m_segNumy; int m_hsegNumx; int m_hsegNumy; float *m_SFrequency_cx; float *m_SFrequency_cy; int *m_PickPoint_cx; int *m_PickPoint_cy; int *m_Coefficient_cx; int *m_Coefficient_cy; float *m_xc; float *m_yc; float m_sf_base; fftw_complex *m_in, *m_out; fftw_plan m_plan; float **m_inRe; float **m_inIm; float m_cx; float m_cy; float m_cz; float m_amp; }; struct GEN_DLL VoxelStruct // voxel structure - data { int num; // voxel or point number float x; // x axis coordinate float y; // y axis coordinate float z; // z axis coordinate float ph; // phase float r; // amplitude in red channel //float g; // amplitude in green channel //float b; // amplitude in blue channel }; struct GEN_DLL CGHEnvironmentData { int CghWidth; // cgh width int CghHeight; // cgh height int SegmentationSize; int fftSegmentationSize; float rWaveLength; // red laser lambda float rWaveNumber; // red laser lambda float ThetaX; float ThetaY; float DefaultDepth; float xInterval; float yInterval; float xiInterval; float etaInterval; float CGHScale; }; struct GEN_DLL Segment { bool WorkingFlag; long SegmentIndex; int SegSize_x; int SegSize_y; int hSegSize_x; // Half size int hSegSize_y; // Half size double CenterX; double CenterY; double FrequencySlope; }; #endif // !__ophPAS_h
49 
50  void DataInit(CGHEnvironmentData* _CGHE); //µ¥ÀÌÅÍ ÃʱâÈ­
51  void DataInit(OphPointCloudConfig& conf);
52  int ACPASCalcuation(long voxnum, unsigned char *cghfringe, VoxelStruct* h_vox, CGHEnvironmentData* _CGHE); // ÆÐÅÏ°è»ê int ACPASCalcuation(long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf); // ÆÐÅÏ°è»ê void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE); void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf); double *m_pHologram; float m_COStbl[NUMTBL]; float m_SINtbl[NUMTBL]; int m_segSize; int m_hsegSize; int m_dsegSize; int m_segNumx; int m_segNumy; int m_hsegNumx; int m_hsegNumy; float *m_SFrequency_cx; float *m_SFrequency_cy; int *m_PickPoint_cx; int *m_PickPoint_cy; int *m_Coefficient_cx; int *m_Coefficient_cy; float *m_xc; float *m_yc; float m_sf_base; fftw_complex *m_in, *m_out; fftw_plan m_plan; float **m_inRe; float **m_inIm; float m_cx; float m_cy; float m_cz; float m_amp; }; struct GEN_DLL VoxelStruct // voxel structure - data { int num; // voxel or point number float x; // x axis coordinate float y; // y axis coordinate float z; // z axis coordinate float ph; // phase float r; // amplitude in red channel //float g; // amplitude in green channel //float b; // amplitude in blue channel }; struct GEN_DLL CGHEnvironmentData { int CghWidth; // cgh width int CghHeight; // cgh height int SegmentationSize; int fftSegmentationSize; float rWaveLength; // red laser lambda float rWaveNumber; // red laser lambda float ThetaX; float ThetaY; float DefaultDepth; float xInterval; float yInterval; float xiInterval; float etaInterval; float CGHScale; }; struct GEN_DLL Segment { bool WorkingFlag; long SegmentIndex; int SegSize_x; int SegSize_y; int hSegSize_x; // Half size int hSegSize_y; // Half size double CenterX; double CenterY; double FrequencySlope; }; #endif // !__ophPAS_h
53  int ACPASCalcuation(long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf); // ÆÐÅÏ°è»ê void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE); void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf); double *m_pHologram; float m_COStbl[NUMTBL]; float m_SINtbl[NUMTBL]; int m_segSize; int m_hsegSize; int m_dsegSize; int m_segNumx; int m_segNumy; int m_hsegNumx; int m_hsegNumy; float *m_SFrequency_cx; float *m_SFrequency_cy; int *m_PickPoint_cx; int *m_PickPoint_cy; int *m_Coefficient_cx; int *m_Coefficient_cy; float *m_xc; float *m_yc; float m_sf_base; fftw_complex *m_in, *m_out; fftw_plan m_plan; float **m_inRe; float **m_inIm; float m_cx; float m_cy; float m_cz; float m_amp; }; struct GEN_DLL VoxelStruct // voxel structure - data { int num; // voxel or point number float x; // x axis coordinate float y; // y axis coordinate float z; // z axis coordinate float ph; // phase float r; // amplitude in red channel //float g; // amplitude in green channel //float b; // amplitude in blue channel }; struct GEN_DLL CGHEnvironmentData { int CghWidth; // cgh width int CghHeight; // cgh height int SegmentationSize; int fftSegmentationSize; float rWaveLength; // red laser lambda float rWaveNumber; // red laser lambda float ThetaX; float ThetaY; float DefaultDepth; float xInterval; float yInterval; float xiInterval; float etaInterval; float CGHScale; }; struct GEN_DLL Segment { bool WorkingFlag; long SegmentIndex; int SegSize_x; int SegSize_y; int hSegSize_x; // Half size int hSegSize_y; // Half size double CenterX; double CenterY; double FrequencySlope; }; #endif // !__ophPAS_h
54  void ACPAS(long voxelnum, VoxelStruct* _h_vox, CGHEnvironmentData* _CGHE);
55  void ACPAS(long voxelnum, OphPointCloudData *data, OphPointCloudConfig& conf);
56 
57  double *m_pHologram;
58 
59  float m_COStbl[NUMTBL];
60  float m_SINtbl[NUMTBL];
61 
62  int m_segSize;
63  int m_hsegSize;
64  int m_dsegSize;
65  int m_segNumx;
66  int m_segNumy;
67  int m_hsegNumx;
68  int m_hsegNumy;
69 
70  float *m_SFrequency_cx;
71  float *m_SFrequency_cy;
72  int *m_PickPoint_cx;
73  int *m_PickPoint_cy;
74  int *m_Coefficient_cx;
75  int *m_Coefficient_cy;
76  float *m_xc;
77  float *m_yc;
78 
79  float m_sf_base;
80 
81  fftw_complex *m_in, *m_out;
82  fftw_plan m_plan;
83 
84  float **m_inRe;
85  float **m_inIm;
86 
87  float m_cx;
88  float m_cy;
89  float m_cz;
90  float m_amp;
91 };
92 
93 struct GEN_DLL VoxelStruct // voxel structure - data
94 {
95  int num; // voxel or point number
96  float x; // x axis coordinate
97  float y; // y axis coordinate
98  float z; // z axis coordinate
99  float ph; // phase
100  float r; // amplitude in red channel
101  //float g; // amplitude in green channel
102  //float b; // amplitude in blue channel
103 };
104 
106 {
107  int CghWidth; // cgh width
108  int CghHeight; // cgh height
109  int SegmentationSize;
110  int fftSegmentationSize;
111  float rWaveLength; // red laser lambda
112  float rWaveNumber; // red laser lambda
113  float ThetaX;
114  float ThetaY;
115  float DefaultDepth;
116  float xInterval;
117  float yInterval;
118  float xiInterval;
119  float etaInterval;
120  float CGHScale;
121 };
122 
123 struct GEN_DLL Segment
124 {
125  bool WorkingFlag;
126  long SegmentIndex;
127  int SegSize_x;
128  int SegSize_y;
129  int hSegSize_x; // Half size
130  int hSegSize_y; // Half size
131  double CenterX;
132  double CenterY;
133  double FrequencySlope;
134 };
135 #endif // !__ophPAS_h
unsigned char uchar
Definition: typedef.h:64
#define GEN_DLL
Definition: ophGen.h:54
#define NUMTBL
Definition: ophACPAS.h:15
Configuration for Point Cloud.
Definition: ophGen.h:522
Data for Point Cloud.
Definition: ophGen.h:549
Definition: Bitmap.h:49
unsigned int uint
Definition: typedef.h:62
Definition: ophGen.h:68