80 #ifndef __Hologram_Generator_h 81 #define __Hologram_Generator_h 85 #include <QtCore/QDir> 86 #include <QtCore/QFile> 87 #include <QtGui/QImage> 88 #include <QtWidgets/qmessagebox.h> 91 #include "Hologram/fftw3.h" 137 void setMode(
bool isCPU);
146 void GenerateHologram();
149 void ReconstructImage();
165 bool ReadImageDepth(
int ftr);
166 bool prepare_inputdata_CPU(uchar* img, uchar* dimg);
167 bool prepare_inputdata_GPU(uchar* img, uchar* dimg);
172 void GetDepthValues();
173 void change_depth_quan_CPU();
174 void change_depth_quan_GPU();
179 void TransformViewingWindow();
184 void Calc_Holo_by_Depth(
int frame);
185 void Calc_Holo_CPU(
int frame);
186 void Calc_Holo_GPU(
int frame);
187 void Propagation_AngularSpectrum_CPU(
Complex* input_u,
double propagation_dist);
188 void Propagation_AngularSpectrum_GPU(cufftDoubleComplex* input_u,
double propagation_dist);
193 void Encoding_Symmetrization(
ivec2 sig_location);
194 void encoding_CPU(
int cropx1,
int cropx2,
int cropy1,
int cropy2,
ivec2 sig_location);
195 void encoding_GPU(
int cropx1,
int cropx2,
int cropy1,
int cropy2,
ivec2 sig_location);
200 void Write_Result_image(
int ftr);
203 void get_rand_phase_value(
Complex& rand_phase_val);
204 void get_shift_phase_value(
Complex& shift_phase_val,
int idx,
ivec2 sig_location);
206 void fftwShift(
Complex* src,
Complex* dst, fftw_complex* in, fftw_complex* out,
int nx,
int ny,
int type,
bool bNomalized =
false);
207 void exponent_complex(
Complex* val);
217 void Reconstruction(fftw_complex* in, fftw_complex* out);
218 void Test_Propagation_to_Eye_Pupil(fftw_complex* in, fftw_complex* out);
219 void Write_Simulation_image(
int num,
double val);
220 void circshift(
Complex* in,
Complex* out,
int shift_x,
int shift_y,
int nx,
int ny);
double sim_from_
reconstruction variable for testing
int sim_type_
reconstruction variable for testing
double * img_src_
CPU variable - image source data, values are from 0 to 1.
structure for 2-dimensional real type vector and its arithmetic.
double dstep_
the physical increment of each depth map layer.
uint num_of_depth
the number of depth level.
unsigned char * dimg_src_gpu_
GPU variable - depth map data, values are from 0 to 255.
double * depth_index_
CPU variable - quantized depth map data.
Complex * U_complex_
CPU variable - the generated hologram before encoding.
uint DEFAULT_DEPTH_QUANTIZATION
default value of the depth quantization - 256
std::string RESULT_PREFIX
the prefix of the result file - config file
double * sim_final_
reconstruction variable for testing
Complex * hh_complex_
reconstruction variable for testing
bool FLAG_CHANGE_DEPTH_QUANTIZATION
if true, change the depth quantization from the default value.
bool FLAG_STATIC_IMAGE
if true, the input image is static.
int * alpha_map_
CPU variable - calculated alpha map data, values are 0 or 1.
std::string DEPTH_PREFIX
the prefix of the deptmap file - config file
double far_depthmap
FAR_OF_DEPTH_MAP at config file.
double focus_distance_
reconstruction variable for testing
uint START_OF_FRAME_NUMBERING
the start frame number.
Structure variable for hologram paramemters.
unsigned char * img_src_gpu_
GPU variable - image source data, values are from 0 to 255.
std::vector< double > dlevel_
the physical value of all depth map layer.
int Propagation_Method_
propagation method - currently AngularSpectrum
double lambda
WAVELENGTH at config file.
structure for 2-dimensional integer vector and its arithmetic.
ivec2 pn
SLM_PIXEL_NUMBER_X & SLM_PIXEL_NUMBER_Y.
double WAVELENGTH
wave length
std::string Simulation_Result_File_Prefix_
reconstruction variable for testing
std::vector< int > render_depth
Used when only few specific depth levels are rendered, usually for test purpose.
double field_lens
FIELD_LENS at config file.
int sim_step_num_
reconstruction variable for testing
double eye_length_
reconstruction variable for testing
std::string SOURCE_FOLDER
input source folder - config file.
uint NUMBER_OF_DIGIT_OF_FRAME_NUMBERING
the number of digit of frame number.
int test_pixel_number_scale_
reconstruction variable for testing
int Encoding_Method_
encoding method - currently Symmetrization
double f_field_
reconstruction variable for testing
class for the complex number and its arithmetic.
double sim_to_
reconstruction variable for testing
vec2 eye_center_xy_
reconstruction variable for testing
double * dmap_
CPU variable - physical distances of depth map.
ivec2 SLM_pixel_number_xy_
reconstruction variable for testing
vec2 pp
SLM_PIXEL_PITCH_X & SLM_PIXEL_PITCH_Y.
double * u255_fringe_
the final hologram, used for writing the result image.
vec2 Pixel_pitch_xy_
reconstruction variable for testing
double * dmap_src_
CPU variable - depth map data, values are from 0 to 1.
double eye_pupil_diameter_
reconstruction variable for testing
bool RANDOM_PHASE
If true, random phase is imposed on each depth layer.
bool isCPU_
if true, it is implemented on the CPU, otherwise on the GPU.
std::vector< double > dlevel_transform_
transfomed dlevel_ variable
Main class for generating a hologram using depth map data.
std::string RESULT_FOLDER
the name of the result folder - config file
double near_depthmap
NEAR_OF_DEPTH_MAP at config file.
uint NUMBER_OF_DEPTH_QUANTIZATION
depth level of input depthmap.
HologramParams params_
structure variable for hologram parameters
int Transform_Method_
transform method
std::string IMAGE_PREFIX
the prefix of the input image file - config file.
double * depth_index_gpu_
GPU variable - quantized depth map data.
uint NUMBER_OF_FRAME
the total number of the frame.