endo_guide.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "endo_guide.h"
  2. #include "core/imgui_utility.hpp"
  3. app_endo_guide::app_endo_guide(const create_config &_conf) {
  4. conf = _conf;
  5. // initialize object manager
  6. OBJ_SAVE(img_color, image_u8c3());
  7. // initialize modules
  8. auto uvc_cam_conf = uvc_camera_ui::create_config{
  9. .img_name = img_color, .ctx = conf.asio_ctx,
  10. };
  11. uvc_cam = std::make_unique<uvc_camera_ui>(uvc_cam_conf);
  12. auto bg_viewer_conf = image_viewer::create_config{
  13. .mode = VIEW_COLOR_ONLY, .flip_y = true,
  14. .stream = default_cuda_stream,
  15. };
  16. auto &bg_extra_conf = bg_viewer_conf.extra.color;
  17. bg_extra_conf.fmt = COLOR_RGB;
  18. bg_extra_conf.name = img_color;
  19. bg_viewer = std::make_unique<image_viewer>(bg_viewer_conf);
  20. }
  21. void app_endo_guide::show_ui() {
  22. if (ImGui::Begin("Endo Guide Control")) {
  23. ImGui::PushItemWidth(200);
  24. if (ImGui::CollapsingHeader("Camera")) {
  25. auto id_guard = imgui_id_guard("camera");
  26. uvc_cam->show();
  27. }
  28. }
  29. ImGui::End();
  30. }
  31. void app_endo_guide::render_background() {
  32. bg_viewer->render();
  33. }