|
|
@@ -18,10 +18,10 @@ app_endo_guide::app_endo_guide(const create_config &_conf) {
|
|
|
OBJ_SAVE(right_out, image_ptr());
|
|
|
|
|
|
OBJ_SIG(left_raw)->connect([this](auto _) {
|
|
|
- debayer_raw::call({left_raw, left_rgb, &left_cam.stream});
|
|
|
+ debayer_raw::call({left_raw, left_rgb, default_cuda_stream});
|
|
|
});
|
|
|
OBJ_SIG(right_raw)->connect([this](auto _) {
|
|
|
- debayer_raw::call({right_raw, right_rgb, &right_cam.stream});
|
|
|
+ debayer_raw::call({right_raw, right_rgb, default_cuda_stream});
|
|
|
});
|
|
|
|
|
|
// initialize sophiar
|
|
|
@@ -43,9 +43,9 @@ app_endo_guide::app_endo_guide(const create_config &_conf) {
|
|
|
mvs_conf.cameras.push_back({.dev_name = LOAD_STR("left_camera_name"), .img_name = left_raw});
|
|
|
mvs_conf.cameras.push_back({.dev_name = LOAD_STR("right_camera_name"), .img_name = right_raw});
|
|
|
mvs_cam = std::make_unique<mvs_camera_ui>(mvs_conf);
|
|
|
-// mvs_cam->cap_info_sig.connect([this](auto info) {
|
|
|
-// out_streamer->change_frame_rate(info.frame_rate);
|
|
|
-// });
|
|
|
+ mvs_cam->cap_info_sig.connect([this](auto info) {
|
|
|
+ out_streamer->change_frame_rate(info.frame_rate);
|
|
|
+ });
|
|
|
|
|
|
auto bg_viewer_conf = image_viewer::create_config{
|
|
|
.mode = VIEW_STEREO, .flip_y = true,
|
|
|
@@ -97,7 +97,7 @@ app_endo_guide::app_endo_guide(const create_config &_conf) {
|
|
|
auto helper_conf = image_augment_helper_v2::create_config{
|
|
|
.img_name = left_rgb, .mask_name = invalid_obj_name,
|
|
|
.out_name = left_out, .img_flip_y = false,
|
|
|
- .manager = aug_manager.get(), .stream = &left_cam.stream,
|
|
|
+ .manager = aug_manager.get(), .stream = default_cuda_stream,
|
|
|
.ctx = main_conf.asio_ctx,
|
|
|
.sophiar_conn = sophiar_conn.get(),
|
|
|
.transform_var = LOAD_STR("left_camera_transform_var"),
|
|
|
@@ -109,7 +109,7 @@ app_endo_guide::app_endo_guide(const create_config &_conf) {
|
|
|
helper_conf = image_augment_helper_v2::create_config{
|
|
|
.img_name = right_rgb, .mask_name = invalid_obj_name,
|
|
|
.out_name = right_out, .img_flip_y = false,
|
|
|
- .manager = aug_manager.get(), .stream = &right_cam.stream,
|
|
|
+ .manager = aug_manager.get(), .stream = default_cuda_stream,
|
|
|
.ctx = main_conf.asio_ctx,
|
|
|
.sophiar_conn = sophiar_conn.get(),
|
|
|
.transform_var = LOAD_STR("right_camera_transform_var"),
|
|
|
@@ -135,22 +135,41 @@ app_endo_guide::app_endo_guide(const create_config &_conf) {
|
|
|
};
|
|
|
monitor = std::make_unique<sophiar_monitor>(monitor_conf);
|
|
|
|
|
|
+ auto output_size = cv::Size(
|
|
|
+ LOAD_NUMBER(int, "output_width"),
|
|
|
+ LOAD_NUMBER(int, "output_height"));
|
|
|
+ auto stereo_aug_conf = stereo_augment_helper::create_config{
|
|
|
+ .left_name = left_out, .right_name = right_out,
|
|
|
+ .out_name = stereo_out, .fbo_size = output_size,
|
|
|
+ .flip_image = false, .stream = default_cuda_stream
|
|
|
+ };
|
|
|
+ stereo_aug = std::make_unique<stereo_augment_helper>(stereo_aug_conf);
|
|
|
+
|
|
|
+ auto streamer_conf = image_streamer::create_config{
|
|
|
+ .img_name = stereo_out, .asio_ctx = main_conf.asio_ctx,
|
|
|
+ .cuda_ctx = main_conf.cuda_ctx, .stream = default_cuda_stream
|
|
|
+ };
|
|
|
+ out_streamer = std::make_unique<image_streamer>(streamer_conf);
|
|
|
+ out_streamer->sig_req_size.connect([this](auto size) {
|
|
|
+ post(*main_conf.asio_ctx, [=, this] { stereo_aug->resize(size); });
|
|
|
+ });
|
|
|
+
|
|
|
auto sim_info = camera_calibrator::simulate_info_type{
|
|
|
.data_path = "/home/tpx/project/DepthGuide/cmake-build-debug/exp-20240605/calib/calib_data_c5.txt",
|
|
|
.img_size = cv::Size(1920, 1080),
|
|
|
};
|
|
|
cam_calib->simulate_process(sim_info);
|
|
|
|
|
|
-// auto reg_conf = registration_config{
|
|
|
-// .conn = sophiar_conn.get(),
|
|
|
-// .probe_model_path = LOAD_STR("probe_model"),
|
|
|
-// };
|
|
|
-// reg.reset(registration::create(reg_conf));
|
|
|
-// for (auto reg_item: LOAD_LIST("registration_list")) {
|
|
|
-// auto item_conf = registration_target::from_yaml(reg_item);
|
|
|
-// reg->add_target(item_conf);
|
|
|
-// }
|
|
|
-//
|
|
|
+ auto reg_conf = registration_config{
|
|
|
+ .conn = sophiar_conn.get(),
|
|
|
+ .probe_model_path = LOAD_STR("probe_model"),
|
|
|
+ };
|
|
|
+ reg.reset(registration::create(reg_conf));
|
|
|
+ for (auto reg_item: LOAD_LIST("registration_list")) {
|
|
|
+ auto item_conf = registration_target::from_yaml(reg_item);
|
|
|
+ reg->add_target(item_conf);
|
|
|
+ }
|
|
|
+
|
|
|
// auto eval_conf = calib_eval::record_config{
|
|
|
// .img_name = img_color,
|
|
|
// .sophiar_conn = sophiar_conn.get(), .transform_var_name = "femur_in_camera_ref",
|
|
|
@@ -173,25 +192,35 @@ void app_endo_guide::show_ui() {
|
|
|
mvs_cam->show();
|
|
|
}
|
|
|
|
|
|
- if (ImGui::CollapsingHeader("Tracker")) {
|
|
|
+ if (ImGui::CollapsingHeader("Augmentation")) {
|
|
|
+ auto guard = imgui_id_guard("augmentation");
|
|
|
+
|
|
|
+ ImGui::SeparatorText("Actions");
|
|
|
if (ImGui::Button("Start")) {
|
|
|
start_tracking();
|
|
|
}
|
|
|
ImGui::SameLine();
|
|
|
ImGui::Checkbox("Registration", &enable_reg);
|
|
|
+
|
|
|
+ ImGui::SeparatorText("Status");
|
|
|
monitor->show();
|
|
|
+
|
|
|
+ ImGui::SeparatorText("Scene");
|
|
|
{
|
|
|
- ImGui::SeparatorText("Scene");
|
|
|
auto id_guard = imgui_id_guard("augment_scene");
|
|
|
aug_manager->show();
|
|
|
- if (ImGui::TreeNode("Endo Camera")) {
|
|
|
- aug_helper->get_camera_helper()->show();
|
|
|
- ImGui::TreePop();
|
|
|
- }
|
|
|
- if (ImGui::TreeNode("MVS Camera")) {
|
|
|
- left_cam.aug_helper->get_camera_helper()->show();
|
|
|
- ImGui::TreePop();
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ ImGui::SeparatorText("Camera");
|
|
|
+ auto helper = aug_helper->get_camera_helper();
|
|
|
+ if (helper != nullptr && ImGui::TreeNode("Endo Camera")) {
|
|
|
+ helper->show();
|
|
|
+ ImGui::TreePop();
|
|
|
+ }
|
|
|
+ helper = left_cam.aug_helper->get_camera_helper();
|
|
|
+ if (helper != nullptr && ImGui::TreeNode("MVS Camera")) {
|
|
|
+ helper->show();
|
|
|
+ ImGui::TreePop();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -205,6 +234,18 @@ void app_endo_guide::show_ui() {
|
|
|
acl->show();
|
|
|
}
|
|
|
|
|
|
+ if (ImGui::CollapsingHeader("Streamer")) {
|
|
|
+ {
|
|
|
+ ImGui::SeparatorText("Output");
|
|
|
+ auto id_guard = imgui_id_guard("stereo");
|
|
|
+ stereo_aug->show();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ auto id_guard = imgui_id_guard("streamer");
|
|
|
+ out_streamer->show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (ImGui::CollapsingHeader("Debug")) {
|
|
|
if (ImGui::TreeNode("Background")) {
|
|
|
bg_viewer->show();
|
|
|
@@ -222,10 +263,10 @@ void app_endo_guide::show_ui() {
|
|
|
}
|
|
|
ImGui::End();
|
|
|
|
|
|
-// if (enable_reg) {
|
|
|
-// reg->process();
|
|
|
-// reg->show();
|
|
|
-// }
|
|
|
+ if (enable_reg) {
|
|
|
+ reg->process();
|
|
|
+ reg->show();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void app_endo_guide::render_background() {
|