The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/tracking: Support JPEG output in euroc recorder

+11 -2
+11 -2
src/xrt/auxiliary/tracking/t_euroc_recorder.cpp
··· 13 13 #include "util/u_frame.h" 14 14 #include "util/u_sink.h" 15 15 #include "util/u_var.h" 16 + #include "util/u_debug.h" 16 17 17 18 #include <cassert> 18 19 #include <ctime> ··· 24 25 #include <iomanip> 25 26 26 27 #include <opencv2/imgcodecs.hpp> 28 + 29 + DEBUG_GET_ONCE_BOOL_OPTION(euroc_recorder_use_jpg, "EUROC_RECORDER_USE_JPG", false); 27 30 28 31 //! @todo: Now that IMU sinks support groundtruth, we could save it here as well. 29 32 ··· 43 46 bool recording; //!< Whether samples are being recorded 44 47 bool files_created; //!< Whether the dataset directory structure has been created 45 48 struct u_var_button recording_btn; //!< UI button to start/stop `recording` 49 + 50 + bool use_jpg; //! Whether or not we should save images as .jpg files 46 51 47 52 // Cloner sinks: copy frame to heap for quick release of the original 48 53 struct xrt_slam_sinks cloner_queues; //!< Queue sinks that write into cloner sinks ··· 146 151 147 152 assert(frame->format == XRT_FORMAT_L8 || frame->format == XRT_FORMAT_R8G8B8); // Only formats supported 148 153 auto img_type = frame->format == XRT_FORMAT_L8 ? CV_8UC1 : CV_8UC3; 149 - string img_path = er->path + "/mav0/" + cam_name + "/data/" + std::to_string(ts) + ".png"; 154 + string file_extension = er->use_jpg ? ".jpg" : ".png"; 155 + string filename = std::to_string(ts) + file_extension; 156 + string img_path = er->path + "/mav0/" + cam_name + "/data/" + filename; 150 157 cv::Mat img{(int)frame->height, (int)frame->width, img_type, frame->data, frame->stride}; 151 158 cv::imwrite(img_path, img); 152 159 153 160 ofstream *cam_csv = is_left ? er->left_cam_csv : er->right_cam_csv; 154 - *cam_csv << ts << "," << ts << ".png" CSV_EOL; 161 + *cam_csv << ts << "," << filename << CSV_EOL; 155 162 } 156 163 157 164 extern "C" void ··· 280 287 if (record_from_start) { 281 288 euroc_recorder_try_mkfiles(er); 282 289 } 290 + 291 + er->use_jpg = debug_get_bool_option_euroc_recorder_use_jpg(); 283 292 284 293 // Setup sink pipeline 285 294