Time-of-Flight Library(ToF)  3.2.2
data.h
1 #ifndef _CHRONOPTICS_TOF_DATA_H_
2 #define _CHRONOPTICS_TOF_DATA_H_
3 
4 #include <chronoptics/tof/stream.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 /** The different matrix types
11  */
12 enum tof_mat_type {
13  TOF_MAT_TYPE_UINT8 = 0, /** A single unsigned byte */
14  TOF_MAT_TYPE_INT8 = 1, /** A single signed byte */
15  TOF_MAT_TYPE_UINT16 = 2, /** Two unsigned bytes */
16  TOF_MAT_TYPE_INT16 = 3, /** Two signed bytes */
17  TOF_MAT_TYPE_INT32 = 4, /** Four signed bytes */
18  TOF_MAT_TYPE_FLOAT = 5, /** Four bytes floating point value */
19  TOF_MAT_TYPE_DOUBLE = 6, /** Eight bytes floating point value */
20  TOF_MAT_TYPE_FLOAT_4 = 29, /** Four bytes floating point value with four channels */
21  TOF_MAT_TYPE_FLOAT_8 = 61, /** Four bytes floating point value with eight channels */
22 };
23 
24 /** Function signature of callback that's called after a tof_data object is
25  * destructed containing a user pointer
26  * @param pointer The pointer to the data to write into
27  * @param capacity The amount of data the pointer can hold
28  * @param user_data The passed back user data
29  */
30 typedef void (*tof_user_pointer_destructed_t)(uint8_t* pointer, size_t capacity, void* user_data);
31 
32 /** This is the class that contains depth or image data
33  */
34 typedef struct tof_data* tof_data_t;
35 
36 /** Destruct tof_data */
37 TOF_EXPORT void tof_data_delete(tof_data_t ptr);
38 
39 /** Get pointer to data
40  * @param ptr Pointer to class
41  * @param error Pointer to error
42  * @return
43  */
44 TOF_EXPORT void* tof_data_data(tof_data_t ptr, tof_error_t *error);
45 
46 /** Get size of the data
47  * @param ptr Pointer to class
48  * @param error Pointer to error
49  * @return The size
50  */
51 TOF_EXPORT size_t tof_data_size(const tof_data_t ptr, tof_error_t *error);
52 
53 /** Get user data that will get saved to csf file
54  * @param ptr Pointer to class
55  * @param error Pointer to error
56  * @return Set user data
57  */
58 TOF_EXPORT uint64_t tof_data_get_user_data(const tof_data_t ptr, tof_error_t *error);
59 
60 /** Set user data that will get saved to csf file
61  * @param ptr Pointer to class
62  * @param user_data Set user data
63  * @param error Pointer to error
64  */
65 TOF_EXPORT void tof_data_set_user_data(tof_data_t ptr, uint64_t user_data, tof_error_t *error);
66 
67 /** Get the matrix type
68  * @param ptr Pointer to class
69  * @param error Pointer to error
70  * @return The matrix type
71  */
72 TOF_EXPORT enum tof_mat_type tof_data_mat_type(const tof_data_t ptr, tof_error_t *error);
73 
74 /** Get the number of rows
75  * @param ptr Pointer to class
76  * @param error Pointer to error
77  * @return Number of rows
78  */
79 TOF_EXPORT int32_t tof_data_rows(const tof_data_t ptr, tof_error_t *error);
80 
81 /** Get the number of columns
82  * @param ptr Pointer to class
83  * @param error Pointer to error
84  * @return Number of columns
85  */
86 TOF_EXPORT int32_t tof_data_cols(const tof_data_t ptr, tof_error_t *error);
87 
88 /** The frame counter
89  * @param ptr Pointer to class
90  * @param error Pointer to error
91  * @return Frame count
92  */
93 TOF_EXPORT uint16_t tof_data_frame_count(const tof_data_t ptr, tof_error_t *error);
94 
95 /** Get the frame type
96  * @param ptr Pointer to class
97  * @param error Pointer to error
98  * @return The frame type
99  */
100 TOF_EXPORT enum tof_frame_type tof_data_frame_type(const tof_data_t ptr, tof_error_t *error);
101 
102 /** Get the frame id
103  * @param ptr Pointer to class
104  * @param error Pointer to error
105  * @return The frame id
106  */
107 TOF_EXPORT uint32_t tof_data_frame_id(const tof_data_t ptr, tof_error_t *error);
108 
109 /** Get the modulation frequency of the frame
110  * @param ptr Pointer to class
111  * @param error Pointer to error
112  * @return The modulation frequency
113  */
114 TOF_EXPORT float tof_data_modulation_frequency(const tof_data_t ptr, tof_error_t *error);
115 
116 /** Get the integration time of the frame
117  * @param ptr Pointer to class
118  * @param error Pointer to error
119  * @return The integration time
120  */
121 TOF_EXPORT uint32_t tof_data_integration_time(const tof_data_t ptr, tof_error_t *error);
122 
123 /** Get a bit array of the processing performed on the frame
124  * @param ptr Pointer to class
125  * @param error Pointer to error
126  * @return A bit array
127  */
128 TOF_EXPORT uint32_t tof_data_process(const tof_data_t ptr, tof_error_t *error);
129 
130 /** Get the scale used for integer frames, to get the original value divide by
131  * scale
132  * @param ptr Pointer to class
133  * @param error Pointer to error
134  * @return The scale
135  */
136 TOF_EXPORT float tof_data_scale(const tof_data_t ptr, tof_error_t *error);
137 
138 /** Get the addition used for integer frames, to get the original value
139  * substract the addition
140  * @param ptr Pointer to class
141  * @param error Pointer to error
142  * @return The addition
143  */
144 TOF_EXPORT float tof_data_addition(const tof_data_t ptr, tof_error_t *error);
145 
146 /** Get the temperature of various parts of the camera
147  * @param ptr Pointer to class
148  * @param temperatures Temperatures
149  * @param capacity The amount of data the above pointer can hold
150  * @param error Pointer to error
151  * @return Number of pointers filled or complete array size
152  */
153 TOF_EXPORT size_t tof_data_temperatures(const tof_data_t ptr, float* temperatures, size_t capacity, tof_error_t *error);
154 
155 /** Get the synchronization count
156  * @param ptr Pointer to class
157  * @param error Pointer to error
158  * @return Sync count
159  */
160 TOF_EXPORT uint8_t tof_data_sync_count(const tof_data_t ptr, tof_error_t *error);
161 
162 /** Check whether the data uses a pointer supplied by the user
163  * @param ptr Pointer to class
164  * @param error Pointer to error
165  * @return Data allocated by user
166  */
167 TOF_EXPORT bool tof_data_user_allocated(const tof_data_t ptr, tof_error_t *error);
168 
169 /** The user data that was given in the add_user_pointer function
170  * @param ptr Pointer to class
171  * @param error Pointer to error
172  * @return User pointer
173  */
174 TOF_EXPORT void* tof_data_user_pointer(const tof_data_t ptr, tof_error_t *error);
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif