50 #include "ophPointCloud.h" 52 namespace fs = std::experimental::filesystem;
58 std::string proj_dir = fs::current_path().generic_string();
59 std::string conf_file = proj_dir +
"/../dataset/Dice/PointCloud/Dice_PointCloud.xml";
62 if (!Hologram->
readConfig(conf_file.c_str())) {
63 std::cerr <<
"Fail to load Config file : " << conf_file << std::endl;
68 std::string pc_file = proj_dir +
"/../dataset/Dice/PointCloud/dice_100000.ply";
70 std::cerr <<
"Fail to load Point Cloud file : " << pc_file << std::endl;
83 std::string res_path =
"./result/";
84 if (!fs::exists(res_path)) {
85 fs::create_directories(res_path);
89 time_t cur_time = time(
nullptr);
93 localtime_s(&local, &cur_time);
95 localtime_r(&cur_time, &local);
100 sprintf_s(buff,
"%4d%02d%02d-%02d%02d%02d",
101 local.tm_year + 1900, local.tm_mon + 1, local.tm_mday,
102 local.tm_hour, local.tm_min, local.tm_sec);
104 sprintf(buff,
"%4d%02d%02d-%02d%02d%02d",
105 local.tm_year + 1900, local.tm_mon + 1, local.tm_mday,
106 local.tm_hour, local.tm_min, local.tm_sec);
109 std::string ohc_file = res_path +
"pc_sample_" + std::string(buff) +
".ohc";
110 if (!Hologram->
saveAsOhc(ohc_file.c_str())) {
111 std::cerr <<
"Fail to save OHC file : " << ohc_file << std::endl;
122 std::string bmp_file = res_path +
"pc_sample_" + std::string(buff) +
".bmp";
123 if (!Hologram->
save(bmp_file.c_str())) {
124 std::cerr <<
"Fail to save BMP file : " << bmp_file << std::endl;
void SetMode(unsigned int mode)
void normalize(void)
Normalization function to save as image file after hologram creation.
bool save(const char *fname, uint8_t bitsperpixel=8, uchar *src=nullptr, uint px=0, uint py=0)
Function for saving image files.
int loadPointCloud(const char *pc_file)
override
bool readConfig(const char *cfg_file)
Import Specification Config File(*.config) file.
Openholo Point Cloud based Compter-generated holography.
virtual void encoding(unsigned int ENCODE_FLAG, unsigned int SSB_PASSBAND)
virtual bool saveAsOhc(const char *fname)
Function to write OHC file
unsigned long release(void)
Call release() when reference is finished.
Real generateHologram(uint diff_flag=PC_DIFF_RS)
Generate a hologram, main funtion.