remote_ar_v2.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "remote_ar_v2.h"
  2. #include "image_process_v5/sp_image.h"
  3. #include "image_process_v5/osg_helper.h"
  4. #include "image_process_v5/image_process.h"
  5. #include "core/yaml_utility.hpp"
  6. #include "core/imgui_utility.hpp"
  7. app_remote_ar_v2::app_remote_ar_v2(create_config _conf)
  8. : main_conf(std::move(_conf)) {
  9. auto conf = main_conf.ext_conf;
  10. if (true) {
  11. auto sub_conf = mvs_camera_ui::create_config{.ctx = main_conf.asio_ctx};
  12. sub_conf.cameras.push_back({.dev_name = LOAD_STR("left_camera_name"), .img_name = left_img_id});
  13. sub_conf.cameras.push_back({.dev_name = LOAD_STR("right_camera_name"), .img_name = right_img_id});
  14. mvs_cam.emplace(sub_conf);
  15. // mvs_cam->cap_info_sig.connect([this](auto info) {
  16. // out_streamer->change_frame_rate(info.frame_rate);
  17. // });
  18. }
  19. if (true) {
  20. auto sub_conf = stereo_output_helper::create_config();
  21. sub_conf.left_name = left_img_id;
  22. sub_conf.right_name = right_img_id;
  23. sub_conf.out_name = output_img_id;
  24. // sub_conf.size = cv::Size(1920, 1080);
  25. sub_conf.halve_width = false;
  26. output_helper.emplace(sub_conf);
  27. }
  28. if (true) {
  29. auto sub_conf = image_viewer_v2::create_config();
  30. sub_conf.items.emplace_back(left_img_id, "Left", true);
  31. sub_conf.items.emplace_back(right_img_id, "Right", true);
  32. sub_conf.items.emplace_back(output_img_id, "Output", true);
  33. bg_viewer.emplace(sub_conf);
  34. }
  35. }
  36. app_remote_ar_v2::~app_remote_ar_v2() = default;
  37. void app_remote_ar_v2::render_background() {
  38. bg_viewer->render();
  39. }
  40. void app_remote_ar_v2::show_ui() {
  41. if (ImGui::Begin("Remote AR Control")) {
  42. ImGui::PushItemWidth(200);
  43. if (ImGui::CollapsingHeader("Camera")) {
  44. auto id_guard = imgui_id_guard("camera");
  45. mvs_cam->show();
  46. }
  47. if (ImGui::CollapsingHeader("Debug")) {
  48. if (ImGui::TreeNode("Background")) {
  49. bg_viewer->show_ui();
  50. ImGui::TreePop();
  51. }
  52. }
  53. ImGui::PopItemWidth();
  54. }
  55. ImGui::End();
  56. }