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;
65  int m_segNumx;
66  int m_segNumy;
69 
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
111  float rWaveLength; // red laser lambda
112  float rWaveNumber; // red laser lambda
113  float ThetaX;
114  float ThetaY;
116  float xInterval;
117  float yInterval;
118  float xiInterval;
119  float etaInterval;
120  float CGHScale;
121 };
122 
124 {
129  int hSegSize_x; // Half size
130  int hSegSize_y; // Half size
131  double CenterX;
132  double CenterY;
134 };
135 #endif // !__ophPAS_h
float * m_xc
Definition: ophACPAS.h:76
float ph
Definition: ophACPAS.h:99
int m_segNumy
Definition: ophACPAS.h:66
unsigned char uchar
Definition: typedef.h:64
float * m_yc
Definition: ophACPAS.h:77
#define GEN_DLL
Definition: ophGen.h:54
float m_cx
Definition: ophACPAS.h:87
fftw_plan m_plan
Definition: ophACPAS.h:82
bool WorkingFlag
Definition: ophACPAS.h:125
int * m_PickPoint_cx
Definition: ophACPAS.h:72
float ** m_inIm
Definition: ophACPAS.h:85
float m_cy
Definition: ophACPAS.h:88
fftw_complex * m_out
Definition: ophACPAS.h:81
int * m_Coefficient_cy
Definition: ophACPAS.h:75
double CenterX
Definition: ophACPAS.h:131
double CenterY
Definition: ophACPAS.h:132
int m_segSize
Definition: ophACPAS.h:62
float m_amp
Definition: ophACPAS.h:90
int * m_PickPoint_cy
Definition: ophACPAS.h:73
#define NUMTBL
Definition: ophACPAS.h:15
double * m_pHologram
Definition: ophACPAS.h:57
float * m_SFrequency_cx
Definition: ophACPAS.h:70
float m_sf_base
Definition: ophACPAS.h:79
float r
Definition: ophACPAS.h:100
int m_dsegSize
Definition: ophACPAS.h:64
int * m_Coefficient_cx
Definition: ophACPAS.h:74
int m_hsegNumy
Definition: ophACPAS.h:68
int hSegSize_y
Definition: ophACPAS.h:130
int m_hsegNumx
Definition: ophACPAS.h:67
Configuration for Point Cloud.
Definition: ophGen.h:522
float * m_SFrequency_cy
Definition: ophACPAS.h:71
long SegmentIndex
Definition: ophACPAS.h:126
Data for Point Cloud.
Definition: ophGen.h:549
int SegSize_x
Definition: ophACPAS.h:127
int hSegSize_x
Definition: ophACPAS.h:129
int m_segNumx
Definition: ophACPAS.h:65
float x
Definition: ophACPAS.h:96
int SegSize_y
Definition: ophACPAS.h:128
Definition: Bitmap.h:49
float m_cz
Definition: ophACPAS.h:89
double FrequencySlope
Definition: ophACPAS.h:133
float ** m_inRe
Definition: ophACPAS.h:84
unsigned int uint
Definition: typedef.h:62
float y
Definition: ophACPAS.h:97
Definition: ophGen.h:68
int m_hsegSize
Definition: ophACPAS.h:63
float z
Definition: ophACPAS.h:98