Time-of-Flight Library(ToF)  3.2.4
stream.hpp
1 #ifndef _CHRONOPTICS_TOF_STREAM_HPP_
2 #define _CHRONOPTICS_TOF_STREAM_HPP_
3 
4 #include <chronoptics/tof/stream.h>
5 
6 #include <chronoptics/tof/base.hpp>
7 
8 namespace chronoptics {
9 namespace tof {
10 
11 /** The different frame types that are supported
12  */
13 enum class FrameType {
14  RAW_COMMON = 0, /** The 16bits coming off the OPT8241 image sensor */
15  COMMON = 1, /** Common (A + B) image, 4 or 12 bits depending on the sensor */
16  RAW = 2, /** Raw (A - B) image 12 bits signed data */
17  REAL = 3, /** The real image */
18  IMAGINARY = 4, /** The imaginary image */
19  PHASE = 5, /** The phase image */
20  AMPLITUDE = 6, /** The amplitude image */
21  RADIAL = 7, /** The radial distance image */
22  INTENSITY = 8, /** The intensity image */
23  X = 9, /** The x image of the point cloud */
24  Y = 10, /** The y image of the point cloud */
25  Z = 11, /** The z image of the point cloud */
26  XYZ = 12, /** A complete pointcloud image: float x, float y, float z, float padding */
27  XYZ_AMP = 13, /** A complete pointcloud image with amplitude: float x, float y, float z, float amplitude */
28  XYZ_BGR = 14, /** A complete pointcloud image with bgr: float x, float y, float z, uint8 b, uint8 g, uint8 r, uint8 padding */
29  XYZ_BGR_I = 15, /** A complete pointcloud image with bgr and intensity: float x, float y, float z, uint8 b, uint8 g, uint8 r, uint8 intensity */
30  BGR = 18, /** A color image, encode bgr */
31  YUV = 19, /** A color image encoded in YUV422 */
32  RAW_AB = 20, /** A raw image containing both the A and B tap */
33  MJPEG = 21, /** a color image encoded in mjpeg */
34  BGR_PROJECTED = 22, /** A color image projected to the XYZ locations of the depth sensor */
35  COMPRESSED_DOT = 23, /** The averaged value for each dot. In the XYZAmp format. */
36 };
37 
38 /** This class describes the different data streams coming from the camera
39 */
40 class Stream : public detail::Base<tof_stream, tof_stream_delete> {
41  public:
42  /** Construct from pointer */
43  Stream(tof_stream_t ptr = nullptr) {
44  this->ptr_ = ptr;
45  }
46 
47  /** Get the frame type
48  * @return The frame type
49  */
50  FrameType frame_type() const {
51  return static_cast<FrameType>(tof_stream_frame_type(this->ptr_, TOF_ERROR_HANDLER{}));
52  }
53 
54  /** Get the frame id
55  * @return The frame id
56  */
57  uint32_t frame_id() const {
58  return tof_stream_frame_id(this->ptr_, TOF_ERROR_HANDLER{});
59  }
60 
61  /** Get the modulation frequency of the frame
62  * @return The modulation frequency
63  */
64  float modulation_frequency() const {
65  return tof_stream_modulation_frequency(this->ptr_, TOF_ERROR_HANDLER{});
66  }
67 
68  /** Get the integration time of the frame
69  * @return The integration time
70  */
71  uint32_t integration_time() const {
72  return tof_stream_integration_time(this->ptr_, TOF_ERROR_HANDLER{});
73  }
74 
75  /** Get a bit array of the processing performed on the frame
76  * @return A bit array
77  */
78  uint32_t process() const {
79  return tof_stream_process(this->ptr_, TOF_ERROR_HANDLER{});
80  }
81 
82 };
83 
84 /** Get the string representation of the frame type
85  * @param frame_type Frame type
86  * @return String representation of frame type
87  */
88 inline const char* frame_type_to_string(FrameType frame_type) {
89  return tof_frame_type_to_string(static_cast<tof_frame_type>(frame_type), TOF_ERROR_HANDLER{});
90 }
91 
92 } // tof
93 } // chronoptics
94 
95 #endif
This class describes the different data streams coming from the camera.
Definition: stream.hpp:40
float modulation_frequency() const
Get the modulation frequency of the frame.
Definition: stream.hpp:64
uint32_t integration_time() const
Get the integration time of the frame.
Definition: stream.hpp:71
uint32_t frame_id() const
Get the frame id.
Definition: stream.hpp:57
uint32_t process() const
Get a bit array of the processing performed on the frame.
Definition: stream.hpp:78
Stream(tof_stream_t ptr=nullptr)
Construct from pointer.
Definition: stream.hpp:43
FrameType frame_type() const
Get the frame type.
Definition: stream.hpp:50