types.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #include "types.h"
5 
6 #include <algorithm>
7 #include <iomanip>
8 #include <numeric>
9 #include <fstream>
10 #include <cmath>
11 
12 #include "core/streaming.h"
13 #include "../include/librealsense2/hpp/rs_processing.hpp"
14 
15 #define STRCASE(T, X) case RS2_##T##_##X: {\
16  static const std::string s##T##_##X##_str = make_less_screamy(#X);\
17  return s##T##_##X##_str.c_str(); }
18 
19 const double SQRT_DBL_EPSILON = sqrt(std::numeric_limits<double>::epsilon());
20 
21 namespace librealsense
22 {
23  // The extrinsics on the camera ("raw extrinsics") are in milimeters, but LRS works in meters
24  // Additionally, LRS internal algorithms are
25  // written with a transposed matrix in mind! (see rs2_transform_point_to_point)
27  {
28  float const meters_to_milimeters = 1000;
29  extr.translation[0] *= meters_to_milimeters;
30  extr.translation[1] *= meters_to_milimeters;
31  extr.translation[2] *= meters_to_milimeters;
32 
33  std::swap(extr.rotation[1], extr.rotation[3]);
34  std::swap(extr.rotation[2], extr.rotation[6]);
35  std::swap(extr.rotation[5], extr.rotation[7]);
36  return extr;
37  }
38 
40  {
41  float const milimeters_to_meters = 0.001f;
42  extr.translation[0] *= milimeters_to_meters;
43  extr.translation[1] *= milimeters_to_meters;
44  extr.translation[2] *= milimeters_to_meters;
45 
46  std::swap(extr.rotation[1], extr.rotation[3]);
47  std::swap(extr.rotation[2], extr.rotation[6]);
48  std::swap(extr.rotation[5], extr.rotation[7]);
49  return extr;
50  }
51 
53  {
54  std::string res(str);
55 
56  bool first = true;
57  for (auto i = 0; i < res.size(); i++)
58  {
59  if (res[i] != '_')
60  {
61  if (!first) res[i] = tolower(res[i]);
62  first = false;
63  }
64  else
65  {
66  res[i] = ' ';
67  first = true;
68  }
69  }
70 
71  return res;
72  }
73 
75  rs2_exception_type exception_type) noexcept
76  : librealsense_exception(msg, exception_type)
77  {
78  LOG_DEBUG("recoverable_exception: " << msg);
79  }
80 
81  bool file_exists(const char* filename)
82  {
83  std::ifstream f(filename);
84  return f.good();
85  }
86 
88  {
89  if (frame)
90  frame->release();
91  }
92 
94  {
95  if (frame)
96  frame->release();
97  frame = other.frame;
98  other.frame = nullptr;
99  return *this;
100  }
101 
103  {
104  return frame_holder(*this);
105  }
106 
108  : frame(other.frame)
109  {
110  frame->acquire();
111  }
112 
114  {
115 #define CASE(X) STRCASE(EXCEPTION_TYPE, X)
116  switch(value)
117  {
118  CASE(UNKNOWN)
119  CASE(CAMERA_DISCONNECTED)
120  CASE(BACKEND)
121  CASE(INVALID_VALUE)
122  CASE(WRONG_API_CALL_SEQUENCE)
123  CASE(NOT_IMPLEMENTED)
124  CASE(DEVICE_IN_RECOVERY_MODE)
125  CASE(IO)
126  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
127  }
128 #undef CASE
129  }
130 
132  {
133 #define CASE(X) STRCASE(STREAM, X)
134  switch (value)
135  {
136  CASE(ANY)
137  CASE(DEPTH)
138  CASE(COLOR)
139  CASE(INFRARED)
140  CASE(FISHEYE)
141  CASE(GYRO)
142  CASE(ACCEL)
143  CASE(GPIO)
144  CASE(POSE)
146  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
147  }
148 #undef CASE
149  }
150 
152  {
153 #define CASE(X) STRCASE(SR300_VISUAL_PRESET, X)
154  switch (value)
155  {
156  CASE(SHORT_RANGE)
157  CASE(LONG_RANGE)
158  CASE(BACKGROUND_SEGMENTATION)
159  CASE(GESTURE_RECOGNITION)
160  CASE(OBJECT_SCANNING)
161  CASE(FACE_ANALYTICS)
162  CASE(FACE_LOGIN)
163  CASE(GR_CURSOR)
164  CASE(DEFAULT)
165  CASE(MID_RANGE)
166  CASE(IR_ONLY)
167  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
168  }
169 #undef CASE
170  }
171 
173  {
174 #define CASE(X) STRCASE(SENSOR_MODE, X)
175  switch (value)
176  {
177  CASE(VGA)
178  CASE(XGA)
179  CASE(QVGA)
180  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
181  }
182 #undef CASE
183  }
184 
186  {
187 #define CASE(X) STRCASE(CALIBRATION, X)
188  switch( type )
189  {
190  CASE( AUTO_DEPTH_TO_RGB )
191  CASE( MANUAL_DEPTH_TO_RGB )
192  CASE( THERMAL )
193  default: assert( !is_valid( type ) ); return UNKNOWN_VALUE;
194  }
195 #undef CASE
196  }
197 
199  {
200 #define CASE(X) STRCASE(CALIBRATION, X)
201  switch( value )
202  {
203  CASE( TRIGGERED )
204  CASE( SPECIAL_FRAME )
205  CASE( STARTED )
206  CASE( NOT_NEEDED )
207  CASE( SUCCESSFUL )
208 
209  CASE( BAD_CONDITIONS )
210  CASE( FAILED )
211  CASE( SCENE_INVALID )
212  CASE( BAD_RESULT )
213  CASE( RETRY )
214  default: assert( !is_valid( value ) ); return UNKNOWN_VALUE;
215  }
216 #undef CASE
217  }
218 
220  {
221 #define CASE(X) STRCASE(AMBIENT_LIGHT, X)
222  switch (value)
223  {
224  CASE(NO_AMBIENT)
225  CASE(LOW_AMBIENT)
226  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
227  }
228 #undef CASE
229  }
230 
232  {
233 #define CASE(X) STRCASE(DIGITAL_GAIN, X)
234  switch (value)
235  {
236  CASE(HIGH)
237  CASE(LOW)
238  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
239  }
240 #undef CASE
241  }
242 
244  {
245 #define CASE(X) STRCASE(CAH_TRIGGER, X)
246  switch( value )
247  {
248  CASE( MANUAL )
249  CASE( NOW )
250  CASE( AUTO )
251  default: assert( !is_valid( value ) ); return UNKNOWN_VALUE;
252  }
253 #undef CASE
254  }
255 
257  {
258 #define CASE(X) STRCASE(HOST_PERF, X)
259  switch (value)
260  {
261  CASE(DEFAULT)
262  CASE(LOW)
263  CASE(HIGH)
264  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
265  }
266 #undef CASE
267  }
268 
270  {
271 #define CASE(X) STRCASE(EXTENSION, X)
272  switch (value)
273  {
274  CASE(UNKNOWN)
275  CASE(DEBUG)
276  CASE(INFO)
277  CASE(OPTIONS)
278  CASE(MOTION)
279  CASE(VIDEO)
280  CASE(ROI)
281  CASE(DEPTH_SENSOR)
282  CASE(VIDEO_FRAME)
283  CASE(MOTION_FRAME)
284  CASE(COMPOSITE_FRAME)
285  CASE(POINTS)
286  CASE(DEPTH_FRAME)
287  CASE(ADVANCED_MODE)
288  CASE(RECORD)
289  CASE(VIDEO_PROFILE)
290  CASE(PLAYBACK)
291  CASE(DEPTH_STEREO_SENSOR)
292  CASE(DISPARITY_FRAME)
293  CASE(MOTION_PROFILE)
294  CASE(POSE_FRAME)
295  CASE(POSE_PROFILE)
296  CASE(TM2)
297  CASE(SOFTWARE_DEVICE)
298  CASE(SOFTWARE_SENSOR)
299  CASE(DECIMATION_FILTER)
300  CASE(THRESHOLD_FILTER)
301  CASE(DISPARITY_FILTER)
302  CASE(SPATIAL_FILTER)
303  CASE(TEMPORAL_FILTER)
304  CASE(HOLE_FILLING_FILTER)
305  CASE(ZERO_ORDER_FILTER)
306  CASE(RECOMMENDED_FILTERS)
307  CASE(POSE)
308  CASE(POSE_SENSOR)
309  CASE(WHEEL_ODOMETER)
310  CASE(GLOBAL_TIMER)
311  CASE(UPDATABLE)
312  CASE(UPDATE_DEVICE)
313  CASE(L500_DEPTH_SENSOR)
314  CASE(TM2_SENSOR)
315  CASE(AUTO_CALIBRATED_DEVICE)
316  CASE(COLOR_SENSOR)
317  CASE(MOTION_SENSOR)
318  CASE(FISHEYE_SENSOR)
319  CASE(DEPTH_HUFFMAN_DECODER)
320  CASE(SERIALIZABLE)
321  CASE(FW_LOGGER)
322  CASE(AUTO_CALIBRATION_FILTER)
323  CASE(DEVICE_CALIBRATION)
324  CASE(CALIBRATED_SENSOR)
325  CASE(SEQUENCE_ID_FILTER)
326  CASE(HDR_MERGE)
327  CASE(MAX_USABLE_RANGE_SENSOR)
328  CASE(DEBUG_STREAM_SENSOR)
329  CASE(CALIBRATION_CHANGE_DEVICE)
330  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
331  }
332 #undef CASE
333  }
334 
336  {
337 #define CASE(X) STRCASE(PLAYBACK_STATUS, X)
338  switch (value)
339  {
340  CASE(UNKNOWN)
341  CASE(STOPPED)
342  CASE(PAUSED)
343  CASE(PLAYING)
344  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
345  }
346 #undef CASE
347  }
348 
350  {
351 #define CASE(X) STRCASE(LOG_SEVERITY, X)
352  switch (value)
353  {
354  CASE(DEBUG)
355  CASE(INFO)
356  CASE(WARN)
357  CASE(ERROR)
358  CASE(FATAL)
359  CASE(NONE)
360  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
361  }
362 #undef CASE
363  }
364 
366  {
367 #define CASE(X) STRCASE(OPTION, X)
368  switch (value)
369  {
372  CASE(CONTRAST)
373  CASE(EXPOSURE)
374  CASE(GAIN)
375  CASE(GAMMA)
376  CASE(HUE)
378  CASE(SHARPNESS)
383  CASE(ACCURACY)
419  case RS2_OPTION_LLD_TEMPERATURE: return "LDD temperature";
430  CASE(LED_POWER)
434  case RS2_OPTION_AVALANCHE_PHOTO_DIODE: return "Receiver Gain";
439  //CASE(AMBIENT_LIGHT) // Deprecated - replaced by "DIGITAL_GAIN" option
453  case RS2_OPTION_ALTERNATE_IR: return "Alternate IR";
455  case RS2_OPTION_ENABLE_IR_REFLECTIVITY: return "Enable IR Reflectivity";
458  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
459  }
460 #undef CASE
461  }
462 
464  {
465 #define CASE(X) case RS2_FORMAT_##X: return #X;
466  switch (value)
467  {
468  CASE(ANY)
469  CASE(Z16)
471  CASE(DISPARITY32)
472  CASE(XYZ32F)
473  CASE(YUYV)
474  CASE(RGB8)
475  CASE(BGR8)
476  CASE(RGBA8)
477  CASE(BGRA8)
478  CASE(Y8)
479  CASE(Y16)
480  CASE(RAW10)
481  CASE(RAW16)
482  CASE(RAW8)
483  CASE(UYVY)
484  CASE(MOTION_RAW)
485  CASE(MOTION_XYZ32F)
486  CASE(GPIO_RAW)
487  CASE(6DOF)
488  CASE(Y10BPACK)
489  CASE(DISTANCE)
490  CASE(MJPEG)
491  CASE(Y8I)
492  CASE(Y12I)
493  CASE(INZI)
494  CASE(INVI)
495  CASE(W10)
496  CASE(Z16H)
497  CASE(FG)
498  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
499  }
500 #undef CASE
501  }
502 
504  {
505 #define CASE(X) STRCASE(DISTORTION, X)
506  switch (value)
507  {
508  CASE(NONE)
509  CASE(MODIFIED_BROWN_CONRADY)
510  CASE(INVERSE_BROWN_CONRADY)
511  CASE(FTHETA)
512  CASE(BROWN_CONRADY)
513  CASE(KANNALA_BRANDT4)
514  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
515  }
516 #undef CASE
517  }
518 
520  {
521 #define CASE(X) STRCASE(CAMERA_INFO, X)
522  switch (value)
523  {
524  CASE(NAME)
526  CASE(FIRMWARE_VERSION)
527  CASE(RECOMMENDED_FIRMWARE_VERSION)
528  CASE(PHYSICAL_PORT)
529  CASE(DEBUG_OP_CODE)
530  CASE(ADVANCED_MODE)
531  CASE(PRODUCT_ID)
532  CASE(CAMERA_LOCKED)
533  CASE(PRODUCT_LINE)
534  CASE(USB_TYPE_DESCRIPTOR)
535  CASE(ASIC_SERIAL_NUMBER)
536  CASE(FIRMWARE_UPDATE_ID)
537  CASE(IP_ADDRESS)
538  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
539  }
540 #undef CASE
541  }
542 
544  {
545 #define CASE(X) STRCASE(FRAME_METADATA, X)
546  switch (value)
547  {
548  CASE(FRAME_COUNTER)
549  CASE(FRAME_TIMESTAMP)
550  CASE(SENSOR_TIMESTAMP)
551  CASE(ACTUAL_EXPOSURE)
552  CASE(GAIN_LEVEL)
553  CASE(AUTO_EXPOSURE)
555  CASE(TIME_OF_ARRIVAL)
556  CASE(TEMPERATURE)
557  CASE(BACKEND_TIMESTAMP)
558  CASE(ACTUAL_FPS)
559  CASE(FRAME_LASER_POWER)
560  CASE(FRAME_LASER_POWER_MODE)
561  CASE(EXPOSURE_PRIORITY)
562  CASE(EXPOSURE_ROI_LEFT)
563  CASE(EXPOSURE_ROI_RIGHT)
564  CASE(EXPOSURE_ROI_TOP)
565  CASE(EXPOSURE_ROI_BOTTOM)
567  CASE(CONTRAST)
569  CASE(SHARPNESS)
570  CASE(AUTO_WHITE_BALANCE_TEMPERATURE)
572  CASE(GAMMA)
573  CASE(HUE)
574  CASE(MANUAL_WHITE_BALANCE)
576  CASE(LOW_LIGHT_COMPENSATION)
577  CASE(FRAME_EMITTER_MODE)
578  CASE(FRAME_LED_POWER)
579  CASE(RAW_FRAME_SIZE)
580  CASE(GPIO_INPUT_DATA)
584  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
585  }
586 #undef CASE
587  }
588 
590  {
591 #define CASE(X) STRCASE(TIMESTAMP_DOMAIN, X)
592  switch (value)
593  {
594  CASE(HARDWARE_CLOCK)
595  CASE(SYSTEM_TIME)
596  CASE(GLOBAL_TIME)
597  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
598  }
599 #undef CASE
600  }
601 
603  {
604 #define CASE(X) STRCASE(CALIB_TARGET, X)
605  switch (value)
606  {
607  CASE(RECT_GAUSSIAN_DOT_VERTICES)
608  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
609  }
610 #undef CASE
611  }
612 
614  {
615 #define CASE(X) STRCASE(NOTIFICATION_CATEGORY, X)
616  switch (value)
617  {
618  CASE(FRAMES_TIMEOUT)
619  CASE(FRAME_CORRUPTED)
620  CASE(HARDWARE_ERROR)
621  CASE(HARDWARE_EVENT)
622  CASE(UNKNOWN_ERROR)
623  CASE(FIRMWARE_UPDATE_RECOMMENDED)
624  CASE(POSE_RELOCALIZATION)
625  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
626  }
627 #undef CASE
628  }
630  {
631 #define CASE(X) STRCASE(MATCHER, X)
632  switch (value)
633  {
634  CASE(DI)
635  CASE(DI_C)
636  CASE(DLR_C)
637  CASE(DLR)
638  CASE(DEFAULT)
639  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
640  }
641 
642 #undef CASE
643  }
644 
646  {
647 #define CASE(X) STRCASE(L500_VISUAL_PRESET, X)
648  switch (value)
649  {
650  CASE(CUSTOM)
651  CASE(DEFAULT)
652  //CASE(NO_AMBIENT)
653  case RS2_L500_VISUAL_PRESET_NO_AMBIENT: return "No Ambient Light";
654  //CASE(LOW_AMBIENT)
655  case RS2_L500_VISUAL_PRESET_LOW_AMBIENT: return "Low Ambient Light";
656  CASE(MAX_RANGE)
657  CASE(SHORT_RANGE)
658  CASE(AUTOMATIC)
659  default: assert(!is_valid(value)); return UNKNOWN_VALUE;
660  }
661 #undef CASE
662  }
663 
665  {
666  if (is_any) return "any";
667 
668  std::stringstream s;
669  s << std::setfill('0') << std::setw(2) << m_major << "."
670  << std::setfill('0') << std::setw(2) << m_minor << "."
671  << std::setfill('0') << std::setw(2) << m_patch << "."
672  << std::setfill('0') << std::setw(2) << m_build;
673  return s.str();
674  }
675 
676  std::vector<std::string> firmware_version::split(const std::string& str)
677  {
678  std::vector<std::string> result;
679  auto e = str.end();
680  auto i = str.begin();
681  while (i != e) {
682  i = find_if_not(i, e, [](char c) { return c == '.'; });
683  if (i == e) break;
684  auto j = find(i, e, '.');
685  result.emplace_back(i, j);
686  i = j;
687  }
688  return result;
689  }
690 
692  {
693  return atoi(split(name)[part].c_str());
694  }
695 
698  float3x3 calc_rotation_from_rodrigues_angles(const std::vector<double> rot)
699  {
700  assert(3 == rot.size());
701  float3x3 rot_mat{};
702 
703  double theta = sqrt(std::inner_product(rot.begin(), rot.end(), rot.begin(), 0.0));
704  double r1 = rot[0], r2 = rot[1], r3 = rot[2];
705  if (theta <= SQRT_DBL_EPSILON) // identityMatrix
706  {
707  rot_mat(0, 0) = rot_mat(1, 1) = rot_mat(2, 2) = 1.0;
708  rot_mat(0, 1) = rot_mat(0, 2) = rot_mat(1, 0) = rot_mat(1, 2) = rot_mat(2, 0) = rot_mat(2, 1) = 0.0;
709  }
710  else
711  {
712  r1 /= theta;
713  r2 /= theta;
714  r3 /= theta;
715 
716  double c = cos(theta);
717  double s = sin(theta);
718  double g = 1 - c;
719 
720  rot_mat(0, 0) = float(c + g * r1 * r1);
721  rot_mat(0, 1) = float(g * r1 * r2 - s * r3);
722  rot_mat(0, 2) = float(g * r1 * r3 + s * r2);
723  rot_mat(1, 0) = float(g * r2 * r1 + s * r3);
724  rot_mat(1, 1) = float(c + g * r2 * r2);
725  rot_mat(1, 2) = float(g * r2 * r3 - s * r1);
726  rot_mat(2, 0) = float(g * r3 * r1 - s * r2);
727  rot_mat(2, 1) = float(g * r3 * r2 + s * r1);
728  rot_mat(2, 2) = float(c + g * r3 * r3);
729  }
730 
731  return rot_mat;
732  }
733 
734  calibration_validator::calibration_validator(std::function<bool(rs2_stream, rs2_stream)> extrinsic_validator, std::function<bool(rs2_stream)> intrinsic_validator)
735  : extrinsic_validator(extrinsic_validator), intrinsic_validator(intrinsic_validator)
736  {
737  }
738 
740  : extrinsic_validator([](rs2_stream, rs2_stream) { return true; }), intrinsic_validator([](rs2_stream) { return true; })
741  {
742  }
743 
745  {
746  return extrinsic_validator(from_stream, to_stream);
747  }
749  {
750  return intrinsic_validator(stream);
751  }
752 
753 
754 #define UPDC32(octet, crc) (crc_32_tab[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8))
755 
756  static const uint32_t crc_32_tab[] = { /* CRC polynomial 0xedb88320 */
757  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
758  0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
759  0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
760  0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
761  0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
762  0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
763  0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
764  0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
765  0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
766  0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
767  0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
768  0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
769  0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
770  0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
771  0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
772  0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
773  0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
774  0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
775  0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
776  0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
777  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
778  0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
779  0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
780  0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
781  0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
782  0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
783  0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
784  0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
785  0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
786  0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
787  0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
788  0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
789  0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
790  0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
791  0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
792  0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
793  0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
794  0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
795  0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
796  0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
797  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
798  0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
799  0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
800  };
801 
804  {
805  uint32_t oldcrc32 = 0xFFFFFFFF;
806  for (; bufsize; --bufsize, ++buf)
807  oldcrc32 = UPDC32(*buf, oldcrc32);
808  return ~oldcrc32;
809  }
810 
812  :_dispatcher(10), _callback(nullptr , [](rs2_notifications_callback*) {})
813  {
814  }
815 
817  {
818  _dispatcher.stop();
819  }
820 
821 
823  {
824 
825  _dispatcher.stop();
826 
827  std::lock_guard<std::mutex> lock(_callback_mutex);
828  _callback = std::move(callback);
829  _dispatcher.start();
830  }
832  {
833  return _callback;
834  }
835 
836  void copy(void* dst, void const* src, size_t size)
837  {
838  auto from = reinterpret_cast<uint8_t const*>(src);
839  std::copy(from, from + size, reinterpret_cast<uint8_t*>(dst));
840  }
841 
842  void color_sensor::create_snapshot(std::shared_ptr<color_sensor>& snapshot) const
843  {
844  snapshot = std::make_shared<color_sensor_snapshot>();
845  }
846 }
static const textual_icon lock
Definition: model-views.h:218
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
Definition: rs_sensor.h:22
GLboolean GLboolean g
constexpr const char * DEPTH
std::function< bool(rs2_stream from_stream, rs2_stream to_stream)> extrinsic_validator
Definition: src/types.h:1507
rs2_exception_type
Exception types are the different categories of errors that RealSense API might return.
Definition: rs_types.h:30
const char * get_string(rs2_rs400_visual_preset value)
GLuint const GLchar * name
rs2_calibration_type
Definition: rs_device.h:344
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
GLdouble s
void start()
Definition: concurrency.h:286
std::vector< uint32_t > split(const std::string &s, char delim)
std::string to_string() const
Definition: types.cpp:664
rs2_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
Definition: rs_types.h:45
float translation[3]
Definition: rs_sensor.h:99
std::string make_less_screamy(const char *str)
Definition: types.cpp:52
rs2_sr300_visual_preset
For SR300 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:119
GLfloat value
rs2_calib_target_type
Calibration target type.
Definition: rs_frame.h:74
static const float THERMAL
notifications_callback_ptr _callback
Definition: src/types.h:1134
constexpr const char * ACCEL
GLenum GLenum dst
Definition: glext.h:1751
GLenum GLuint GLsizei bufsize
Definition: glext.h:1776
frame_holder clone() const
Definition: types.cpp:102
GLsizei const GLchar *const * string
#define MAX_DISTANCE
Definition: lz4.c:274
rs2_host_perf_mode
values for RS2_OPTION_HOST_PERFORMANCE option.
Definition: rs_option.h:202
GLenum src
Definition: glext.h:1751
unsigned char uint8_t
Definition: stdint.h:78
e
Definition: rmse.py:177
#define UPDC32(octet, crc)
Definition: types.cpp:754
rs2_cah_trigger
values for RS2_OPTION_TRIGGER_CAMERA_ACCURACY_HEALTH option.
Definition: rs_option.h:192
bool validate_extrinsics(rs2_stream from_stream, rs2_stream to_stream) const
Definition: types.cpp:744
float rotation[9]
Definition: rs_sensor.h:98
bool is_valid(const plane_3d &p)
Definition: rendering.h:243
void release() override
Definition: archive.cpp:191
GLenum GLuint GLenum GLsizei const GLchar * buf
bool validate_intrinsics(rs2_stream stream) const
Definition: types.cpp:748
GLdouble f
recoverable_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
Definition: types.cpp:74
rs2_extrinsics to_raw_extrinsics(rs2_extrinsics extr)
Definition: types.cpp:26
GLsizeiptr size
void stop()
Definition: concurrency.h:294
const GLubyte * c
Definition: glext.h:12690
#define CASE(X)
#define WARN(msg)
Definition: catch.hpp:17431
rs2_extrinsics from_raw_extrinsics(rs2_extrinsics extr)
Definition: types.cpp:39
rs2_calibration_status
Definition: rs_device.h:356
unsigned int uint32_t
Definition: stdint.h:80
const double SQRT_DBL_EPSILON
Definition: types.cpp:19
rs2_matchers
Specifies types of different matchers.
Definition: rs_types.h:230
bool file_exists(const char *filename)
Definition: types.cpp:81
std::shared_ptr< rs2_notifications_callback > notifications_callback_ptr
Definition: src/types.h:1073
rs2_playback_status
constexpr const char * SERIAL_NUMBER
def find(dir, mask)
Definition: file.py:25
def callback(frame)
Definition: t265_stereo.py:91
static std::vector< std::string > split(const std::string &str)
Definition: types.cpp:676
GLint j
rs2_format
A stream&#39;s format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:59
GLint first
constexpr const char * INFRARED
void create_snapshot(std::shared_ptr< color_sensor > &snapshot) const override
Definition: types.cpp:842
constexpr const char * COLOR
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value andis_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
Definition: json.hpp:12141
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
#define NAME
Definition: pybackend.cpp:26
constexpr const char * FISHEYE
rs2_sensor_mode
For setting the camera_mode option.
Definition: rs_option.h:165
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Definition: rs_sensor.h:96
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:166
rs2_notification_category
Category of the librealsense notification.
Definition: rs_types.h:17
GLenum type
rs2_extrinsics extr
Definition: test-pose.cpp:258
void set_callback(notifications_callback_ptr callback)
Definition: types.cpp:822
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
rs2_ambient_light
DEPRECATED! - Use RS2_OPTION_DIGITAL_GAIN instead.
Definition: rs_option.h:175
rs2_digital_gain
digital gain for RS2_OPTION_DIGITAL_GAIN option.
Definition: rs_option.h:183
static int parse_part(const std::string &name, int part)
Definition: types.cpp:691
int i
GLuint res
Definition: glext.h:8856
#define INFO(msg)
Definition: catch.hpp:17429
#define MIN_DISTANCE
Definition: archive.cpp:10
static const uint32_t crc_32_tab[]
Definition: types.cpp:756
std::function< bool(rs2_stream stream)> intrinsic_validator
Definition: src/types.h:1508
#define LOG_DEBUG(...)
Definition: src/types.h:239
#define UNKNOWN_VALUE
Definition: src/types.h:74
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:153
GLuint64EXT * result
Definition: glext.h:10921
notifications_callback_ptr get_callback() const
Definition: types.cpp:831
frame_holder & operator=(frame_holder &&other)
Definition: types.cpp:93
void acquire() override
Definition: archive.h:150
float3x3 calc_rotation_from_rodrigues_angles(const std::vector< double > rot)
Definition: types.cpp:698
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
void copy(void *dst, void const *src, size_t size)
Definition: types.cpp:836
uint32_t calc_crc32(const uint8_t *buf, size_t bufsize)
Calculate CRC code for arbitrary characters buffer.
Definition: types.cpp:803
rs2_l500_visual_preset
For L500 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:151
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:12