10 #include <boost/thread/thread.hpp>
22 std::string , std::string )
29 in_file_.open(sensor_name, std::ifstream::binary);
48 std::fstream::pos_type file_length =
in_file_.tellg();
53 uint32_t first_frame_pos;
66 memcpy(&first_frame_pos, header_ptr,
sizeof(uint32_t));
99 double k_cam[9] = { 0 };
100 double r_cam[9] = { 0 };
101 double p_cam[12] = { 0 };
103 memcpy(&k_cam, cam_info_ptr,
sizeof(k_cam));
104 cam_info_ptr +=
sizeof(k_cam);
106 memcpy(&size_of_d, cam_info_ptr,
sizeof(size_of_d));
107 cam_info_ptr +=
sizeof(size_of_d);
109 double* d_cam = (
double*)malloc(
sizeof(
double) * size_of_d);
111 memcpy(d_cam, cam_info_ptr,
sizeof(
double) * size_of_d);
112 cam_info_ptr += (size_of_d *
sizeof(double));
114 memcpy(&r_cam, cam_info_ptr,
sizeof(r_cam));
115 cam_info_ptr +=
sizeof(r_cam);
117 memcpy(&p_cam, cam_info_ptr,
sizeof(p_cam));
136 for (
int i = 0; i < 8; i++)
143 for (
int i = 0; i < 8; i++)
186 unsigned short* out_conf_frame,
short* out_xyz_frame)
191 boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
194 int num_bytes_in_combo_frame = ((num_samples_in_frame *
bytes_per_pixel_) + 8) * 2;
195 char* frame_buffer =
new char[num_bytes_in_combo_frame];
196 bool error_reading_frame =
false;
199 unsigned short* depth_frame =
new unsigned short[num_samples_in_frame];
200 unsigned short* ab_frame =
new unsigned short[num_samples_in_frame];
207 num_bytes_in_combo_frame += ((num_samples_in_frame *
bytes_per_pixel_) + 8);
220 in_file_.read(frame_buffer, num_bytes_in_combo_frame);
221 if (
in_file_.gcount() != num_bytes_in_combo_frame)
224 error_reading_frame =
true;
232 error_reading_frame =
true;
235 uint8_t* pframe_buffer_ptr =
reinterpret_cast<uint8_t*
>(frame_buffer);
236 uint8_t* ptemp_frame_buffer_ptr;
237 bool read_pass =
false;
238 uint64_t timestamp_ab, timestamp_depth;
239 if (!error_reading_frame)
243 ptemp_frame_buffer_ptr = pframe_buffer_ptr;
244 memcpy(×tamp_depth, ptemp_frame_buffer_ptr,
sizeof(uint64_t));
245 ptemp_frame_buffer_ptr += 8;
248 memcpy(depth_frame, ptemp_frame_buffer_ptr, num_samples_in_frame *
bytes_per_pixel_);
250 ptemp_frame_buffer_ptr = pframe_buffer_ptr;
251 memcpy(×tamp_ab, ptemp_frame_buffer_ptr,
sizeof(uint64_t));
252 if (timestamp_ab == timestamp_depth)
254 ptemp_frame_buffer_ptr += 8;
256 memcpy(ab_frame, ptemp_frame_buffer_ptr, num_samples_in_frame *
bytes_per_pixel_);
264 if (error_reading_frame)
270 delete[] frame_buffer;
271 delete[] depth_frame;
276 unsigned short* temp_depth_frame = depth_frame;
277 unsigned short* temp_ab_frame = ab_frame;
283 *out_depth_frame++ = temp_depth_frame[j];
284 *out_ab_frame++ = temp_ab_frame[j];
293 delete[] frame_buffer;
294 delete[] depth_frame;
309 *timestamp = temp_timestamp;