camera_augment_helper_v2.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_H
  2. #define DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_H
  3. #include "augment_manager_v2.h"
  4. // sophiar
  5. #include "core/local_connection.h"
  6. #include <glm/glm.hpp>
  7. #include <memory>
  8. #include <variant>
  9. class cursor_guide;
  10. class camera_augment_helper_v2 {
  11. public:
  12. struct create_config {
  13. struct fixed_camera_config {
  14. float fov = 60.0f; // field of view
  15. std::string transform_var; // for sophiar
  16. };
  17. struct relative_camera_config {
  18. camera_augment_helper_v2 *parent = nullptr;
  19. glm::mat4 transform = glm::mat4(1.0f); // viewed in parent
  20. };
  21. struct freedom_camera_config {
  22. std::string transform_var; // for sophiar
  23. };
  24. using camera_config_type = std::variant<std::monostate,
  25. freedom_camera_config, fixed_camera_config, relative_camera_config>;
  26. camera_config_type camera;
  27. // sophiar
  28. sophiar_conn_type *sophiar_conn = nullptr;
  29. augment_manager_v2 *manager = nullptr;
  30. cursor_guide *act_guide = nullptr; // active guidance
  31. using io_context = boost::asio::io_context;
  32. io_context *ctx = nullptr;
  33. };
  34. explicit camera_augment_helper_v2(const create_config &conf);
  35. ~camera_augment_helper_v2();
  36. void render();
  37. struct output_config {
  38. cv::Size size;
  39. obj_name_type img_name;
  40. smart_cuda_stream *stream;
  41. };
  42. void render_image(output_config conf);
  43. void show();
  44. void sync_with(camera_augment_helper_v2 *other);
  45. void set_active_guidance(bool flag);
  46. struct guide_info {
  47. glm::vec2 pos;
  48. };
  49. void set_passive_guidance(bool flag, const guide_info &info);
  50. camera_info get_camera();
  51. // latency of image to tracked transform, offset < 0
  52. void set_fixed_transform_latency(int offset);
  53. private:
  54. struct impl;
  55. std::unique_ptr<impl> pimpl;
  56. };
  57. #endif //DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_H