orb_camera.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. // image_ptr, CV_32FC2
  20. // an image that maps each pixel to its undistorted position in the normalized plane
  21. obj_name_type remap_name = invalid_obj_name;
  22. // obj_name_type camera_intrinsic_name = invalid_obj_name; // camera_intrinsic_v2
  23. smart_cuda_stream *stream = nullptr;
  24. boost::asio::io_context *ctx = nullptr;
  25. };
  26. using this_type = orb_camera;
  27. using pointer = std::unique_ptr<this_type>;
  28. static pointer create(create_config conf);
  29. struct video_info {
  30. uint32_t index = 0;
  31. const char *fmt_name = nullptr;
  32. uint32_t fps = 0, width = 0, height = 0;
  33. explicit operator std::string();
  34. };
  35. enum video_type {
  36. V_COLOR, V_DEPTH
  37. };
  38. using vi_list_ptr = std::shared_ptr<std::vector<video_info>>;
  39. vi_list_ptr query_video_info(video_type type);
  40. vi_list_ptr query_d2c_info(uint32_t c_conf_index); // color config index
  41. struct start_config {
  42. struct color_config_type {
  43. bool enable = true;
  44. uint32_t config_index = 0;
  45. obj_name_type name = -1;
  46. } color;
  47. struct depth_config_type {
  48. bool enable = true;
  49. uint32_t config_index = 0;
  50. obj_name_type name = -1;
  51. } depth;
  52. };
  53. bool start(start_config conf);
  54. void stop();
  55. bool is_capturing() const;
  56. private:
  57. struct impl;
  58. std::unique_ptr<impl> pimpl;
  59. };
  60. #endif //DEPTHGUIDE_ORB_CAMERA_H