orb_camera.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef DEPTHGUIDE_ORB_CAMERA_H
  2. #define DEPTHGUIDE_ORB_CAMERA_H
  3. #include "core/cuda_helper.hpp"
  4. #include "core/object_manager.h"
  5. #include <boost/asio/io_context.hpp>
  6. #include <memory>
  7. #include <thread>
  8. #include <vector>
  9. class orb_camera {
  10. public:
  11. ~orb_camera();
  12. struct device_info {
  13. std::string sn_str;
  14. };
  15. using device_info_list_type = std::vector<device_info>;
  16. static device_info_list_type query_device_info();
  17. struct create_config {
  18. const char *sn_str = nullptr; // serial number
  19. smart_cuda_stream *stream = nullptr;
  20. boost::asio::io_context *ctx = nullptr;
  21. };
  22. using this_type = orb_camera;
  23. using pointer = std::unique_ptr<this_type>;
  24. static pointer create(create_config conf);
  25. struct video_info {
  26. uint32_t index = 0;
  27. const char *fmt_name = nullptr;
  28. uint32_t fps = 0, width = 0, height = 0;
  29. explicit operator std::string();
  30. };
  31. enum video_type {
  32. V_COLOR, V_DEPTH
  33. };
  34. std::vector<video_info> *query_video_info(video_type type);
  35. struct start_config {
  36. struct color_config_type {
  37. bool enable = true;
  38. uint32_t config_index = 0;
  39. obj_name_type name = -1;
  40. } color;
  41. struct depth_config_type {
  42. bool enable = true;
  43. uint32_t config_index = 0;
  44. obj_name_type name = -1;
  45. } depth;
  46. };
  47. bool start(start_config conf);
  48. void stop();
  49. bool is_capturing() const;
  50. private:
  51. struct impl;
  52. std::unique_ptr<impl> pimpl;
  53. };
  54. #endif //DEPTHGUIDE_ORB_CAMERA_H