46 #ifndef __ophDepthMap_h 47 #define __ophDepthMap_h 132 bool readConfig(
const char* fname);
143 bool readImage(
const char* fname, IMAGE_TYPE type = COLOR);
156 bool readImageDepth(
const char* source_folder,
const char* img_prefix,
const char* depth_img_prefix);
163 Real generateHologram(
void);
165 virtual void encoding(
unsigned int ENCODE_FLAG);
166 virtual void encoding(
unsigned int ENCODE_FLAG,
unsigned int SSB_PASSBAND);
177 void setViewingWindow(
bool is_ViewingWindow);
183 m_vecRGBImg[
_X] = size[
_X];
184 m_vecRGBImg[
_Y] = size[
_Y];
188 m_vecDepthImg[
_X] = size[
_X];
189 m_vecDepthImg[
_Y] = size[
_Y];
195 void setResolution(
ivec2 resolution);
205 dm_config_.default_depth_quantization = numofdepth;
206 dm_config_.num_of_depth_quantization = numofdepth;
207 dm_config_.num_of_depth = numofdepth;
208 dm_config_.render_depth.clear();
209 dm_config_.change_depth_quantization =
true;
210 for(
int i = 1; i <= (int)numofdepth; i++)
211 dm_config_.render_depth.push_back(i);
215 if (idx < 0 || idx > 2)
return;
216 if (m_vecRGB.size() > idx)
218 if (m_vecRGB[idx] !=
nullptr)
220 delete[] m_vecRGB[idx];
221 m_vecRGB[idx] =
new uchar[size];
222 memcpy(m_vecRGB[idx], buffer, size);
228 memcpy(pImg, buffer, size);
229 m_vecRGB.push_back(pImg);
235 if (depth_img !=
nullptr)
240 depth_img =
new unsigned char[size];
241 memcpy(depth_img, buffer, size);
248 inline void getRenderDepth(std::vector<int>& renderdepth) { renderdepth = dm_config_.render_depth; }
274 bool prepareInputdataCPU();
281 bool prepareInputdataGPU();
289 void getDepthValues();
295 void changeDepthQuanCPU();
302 void changeDepthQuanGPU();
349 bool is_ViewingWindow;
350 unsigned char* depth_img;
351 vector<uchar*> m_vecRGB;
354 unsigned char* img_src_gpu;
355 unsigned char* dimg_src_gpu;
356 Real* depth_index_gpu;
358 vector<Real *> m_vecImgSrc;
359 vector<int *> m_vecAlphaMap;
362 vector<short> depth_fill;
367 vector<Real> dlevel_transform;
371 cufftDoubleComplex* u_o_gpu_;
372 cufftDoubleComplex* u_complex_gpu_;
373 cufftDoubleComplex* k_temp_d_;
375 cudaStream_t stream_;
380 #endif //>__ophDepthMap_h void setNearDepth(Real neardepth)
void setRGBImageBuffer(int idx, unsigned char *buffer, unsigned long long size)
void getRenderDepth(std::vector< int > &renderdepth)
void setFieldLens(Real fieldlens)
void setDepthImgSize(ivec2 size)
void setConfig(OphDepthMapConfig config)
structure for 2-dimensional integer vector and its arithmetic.
void setRGBImgSize(ivec2 size)
void normalize(const Complex< T > *src, Complex< T > *dst, const int &size)
Normalize all elements of Complex<T>* src from 0 to 1.
void setFarDepth(Real fardetph)
const OphDepthMapConfig & getConfig()
This class generates CGH based on depth map.
unsigned char * getDepthImageBuffer()
void setDepthImageBuffer(unsigned char *buffer, unsigned long long size)
void setNumOfDepth(uint numofdepth)
Configuration for Depth Map.
unsigned char * getRGBImageBuffer(int idx)