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
105
struct
GEN_DLL
CGHEnvironmentData
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
ophACPAS::m_xc
float * m_xc
Definition:
ophACPAS.h:76
VoxelStruct::num
int num
Definition:
ophACPAS.h:95
VoxelStruct::ph
float ph
Definition:
ophACPAS.h:99
CGHEnvironmentData::DefaultDepth
float DefaultDepth
Definition:
ophACPAS.h:115
ophACPAS::m_segNumy
int m_segNumy
Definition:
ophACPAS.h:66
oph::uchar
unsigned char uchar
Definition:
typedef.h:64
ophACPAS::m_yc
float * m_yc
Definition:
ophACPAS.h:77
GEN_DLL
#define GEN_DLL
Definition:
ophGen.h:54
ophACPAS::m_cx
float m_cx
Definition:
ophACPAS.h:87
ophACPAS::m_plan
fftw_plan m_plan
Definition:
ophACPAS.h:82
Segment::WorkingFlag
bool WorkingFlag
Definition:
ophACPAS.h:125
ophACPAS::m_PickPoint_cx
int * m_PickPoint_cx
Definition:
ophACPAS.h:72
ophACPAS::m_inIm
float ** m_inIm
Definition:
ophACPAS.h:85
ophACPAS::m_cy
float m_cy
Definition:
ophACPAS.h:88
CGHEnvironmentData::SegmentationSize
int SegmentationSize
Definition:
ophACPAS.h:109
CGHEnvironmentData::rWaveNumber
float rWaveNumber
Definition:
ophACPAS.h:112
ophACPAS::m_out
fftw_complex * m_out
Definition:
ophACPAS.h:81
ophACPAS::m_Coefficient_cy
int * m_Coefficient_cy
Definition:
ophACPAS.h:75
Segment::CenterX
double CenterX
Definition:
ophACPAS.h:131
Segment::CenterY
double CenterY
Definition:
ophACPAS.h:132
CGHEnvironmentData::CghHeight
int CghHeight
Definition:
ophACPAS.h:108
ophACPAS::m_segSize
int m_segSize
Definition:
ophACPAS.h:62
CGHEnvironmentData::xiInterval
float xiInterval
Definition:
ophACPAS.h:118
CGHEnvironmentData::yInterval
float yInterval
Definition:
ophACPAS.h:117
ophGen.h
CGHEnvironmentData::CghWidth
int CghWidth
Definition:
ophACPAS.h:107
VoxelStruct
Definition:
ophACPAS.h:93
ophACPAS::m_amp
float m_amp
Definition:
ophACPAS.h:90
ophACPAS::m_PickPoint_cy
int * m_PickPoint_cy
Definition:
ophACPAS.h:73
NUMTBL
#define NUMTBL
Definition:
ophACPAS.h:15
ophACPAS::m_pHologram
double * m_pHologram
Definition:
ophACPAS.h:57
Segment
Definition:
ophACPAS.h:123
ophACPAS::m_SFrequency_cx
float * m_SFrequency_cx
Definition:
ophACPAS.h:70
CGHEnvironmentData::ThetaY
float ThetaY
Definition:
ophACPAS.h:114
ophACPAS::m_sf_base
float m_sf_base
Definition:
ophACPAS.h:79
VoxelStruct::r
float r
Definition:
ophACPAS.h:100
ophACPAS::m_dsegSize
int m_dsegSize
Definition:
ophACPAS.h:64
CGHEnvironmentData::rWaveLength
float rWaveLength
Definition:
ophACPAS.h:111
ophACPAS::m_Coefficient_cx
int * m_Coefficient_cx
Definition:
ophACPAS.h:74
ophACPAS::m_hsegNumy
int m_hsegNumy
Definition:
ophACPAS.h:68
Segment::hSegSize_y
int hSegSize_y
Definition:
ophACPAS.h:130
CGHEnvironmentData::xInterval
float xInterval
Definition:
ophACPAS.h:116
ophACPAS::m_hsegNumx
int m_hsegNumx
Definition:
ophACPAS.h:67
CGHEnvironmentData::etaInterval
float etaInterval
Definition:
ophACPAS.h:119
CGHEnvironmentData
Definition:
ophACPAS.h:105
OphPointCloudConfig
Configuration for Point Cloud.
Definition:
ophGen.h:522
CGHEnvironmentData::CGHScale
float CGHScale
Definition:
ophACPAS.h:120
ophACPAS::m_SFrequency_cy
float * m_SFrequency_cy
Definition:
ophACPAS.h:71
CGHEnvironmentData::ThetaX
float ThetaX
Definition:
ophACPAS.h:113
Segment::SegmentIndex
long SegmentIndex
Definition:
ophACPAS.h:126
OphPointCloudData
Data for Point Cloud.
Definition:
ophGen.h:549
Segment::SegSize_x
int SegSize_x
Definition:
ophACPAS.h:127
Segment::hSegSize_x
int hSegSize_x
Definition:
ophACPAS.h:129
ophACPAS::m_segNumx
int m_segNumx
Definition:
ophACPAS.h:65
CGHEnvironmentData::fftSegmentationSize
int fftSegmentationSize
Definition:
ophACPAS.h:110
VoxelStruct::x
float x
Definition:
ophACPAS.h:96
Segment::SegSize_y
int SegSize_y
Definition:
ophACPAS.h:128
oph
Definition:
Bitmap.h:49
ophACPAS::m_cz
float m_cz
Definition:
ophACPAS.h:89
Segment::FrequencySlope
double FrequencySlope
Definition:
ophACPAS.h:133
ophACPAS::m_inRe
float ** m_inRe
Definition:
ophACPAS.h:84
oph::uint
unsigned int uint
Definition:
typedef.h:62
VoxelStruct::y
float y
Definition:
ophACPAS.h:97
ophACPAS
Definition:
ophACPAS.h:28
ophGen
Definition:
ophGen.h:68
ophACPAS::m_hsegSize
int m_hsegSize
Definition:
ophACPAS.h:63
VoxelStruct::z
float z
Definition:
ophACPAS.h:98
Openholo
ophgen
src
ophACPAS.h
Generated by
1.8.14