Time-of-Flight Library(ToF) 4.0.1
 
csf_writer.hpp
1#ifndef _CHRONOPTICS_TOF_CSF_WRITER_HPP_
2#define _CHRONOPTICS_TOF_CSF_WRITER_HPP_
3
4#include <chronoptics/tof/csf_writer.h>
5
6#include <chronoptics/tof/camera.hpp>
7#include <chronoptics/tof/camera_config.hpp>
8#include <chronoptics/tof/calibration.hpp>
9#include <chronoptics/tof/data.hpp>
10
11namespace chronoptics {
12namespace tof {
13
14/** The csf writer class takes care of writing depth frames to disk. The class
15 * has to be created from either a Camera or csf reader, because it needs
16 * information about the camera that was used to record the depth frames.
17 * Therefore you should only write depth frames coming from one camera into the
18 * same writer
19
20*/
21class CsfWriter : public detail::Base<tof_csf_writer, tof_csf_writer_delete> {
22 public:
23 /** Construct from pointer */
24 CsfWriter(tof_csf_writer_t ptr = nullptr) {
25 this->ptr_ = ptr;
26 }
27
28 /** Construct the csf writer from a camera
29 * @param file_location Path to where the csf file should be created
30 * @param camera The camera to get the camera config and calibration file from
31 */
32 CsfWriter(StringView file_location, const Camera &camera) : CsfWriter(tof_csf_writer_new_from_camera(file_location, *reinterpret_cast<const tof_camera_t*>(&camera), TOF_ERROR_HANDLER{})) {}
33
34 /** Construct csf writer from calibration and configuration
35 * @param file_location Path to where the csf file should be created
36 * @param camera_config Camera configuration
37 * @param calibration Calibration
38 * @param serial Serial number of camera
39 */
40 CsfWriter(StringView file_location, const CameraConfig &camera_config, const Calibration &calibration, StringView serial) : CsfWriter(tof_csf_writer_new_from_raw_data(file_location, *reinterpret_cast<const tof_camera_config_t*>(&camera_config), *reinterpret_cast<const tof_calibration_t*>(&calibration), serial, TOF_ERROR_HANDLER{})) {}
41
42 /** Write frame to csf file
43 * @param frame A data frame
44 */
45 void write_frame(const Data &frame) {
46 return tof_csf_writer_write_frame(this->ptr_, *reinterpret_cast<const tof_data_t*>(&frame), TOF_ERROR_HANDLER{});
47 }
48
49};
50
51} // tof
52} // chronoptics
53
54#endif
This class contains all the calibration information.
Definition: calibration.hpp:38
This class allows you to view/edit the camera settings.
The main interface to the depth cameras.
Definition: camera.hpp:17
The csf writer class takes care of writing depth frames to disk.
Definition: csf_writer.hpp:21
CsfWriter(tof_csf_writer_t ptr=nullptr)
Construct from pointer.
Definition: csf_writer.hpp:24
void write_frame(const Data &frame)
Write frame to csf file.
Definition: csf_writer.hpp:45
CsfWriter(StringView file_location, const CameraConfig &camera_config, const Calibration &calibration, StringView serial)
Construct csf writer from calibration and configuration.
Definition: csf_writer.hpp:40
CsfWriter(StringView file_location, const Camera &camera)
Construct the csf writer from a camera.
Definition: csf_writer.hpp:32
This is the class that contains depth or image data.
Definition: data.hpp:31