From 9986f4a1565f204f284c9bab5ac42f723e8ed02b Mon Sep 17 00:00:00 2001 From: ElliotScher Date: Sat, 14 Dec 2024 13:26:45 -0500 Subject: [PATCH] disable debug windows on linux --- wpical/src/main/native/cpp/WPIcal.cpp | 12 +++++++++--- wpical/src/main/native/cpp/fieldcalibration.cpp | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/wpical/src/main/native/cpp/WPIcal.cpp b/wpical/src/main/native/cpp/WPIcal.cpp index 0090384a7bc..d468f1a7e1a 100644 --- a/wpical/src/main/native/cpp/WPIcal.cpp +++ b/wpical/src/main/native/cpp/WPIcal.cpp @@ -24,6 +24,12 @@ namespace gui = wpi::gui; const char* GetWPILibVersion(); +#ifdef __linux__ +const bool showDebug = false; +#else +const bool showDebug = true; +#endif + namespace wpical { std::string_view GetResource_wpical_16_png(); std::string_view GetResource_wpical_32_png(); @@ -202,7 +208,7 @@ static void DisplayGui() { int calibrationOutput = fieldcalibration::calibrate( selected_field_calibration_directory.c_str(), calibration_json_path, selected_camera_intrinsics, selected_field_map.c_str(), pinnedTag, - true); + showDebug); if (calibrationOutput == 1) { ImGui::OpenPopup("Field Calibration Error"); @@ -328,7 +334,7 @@ static void DisplayGui() { std::cout << "calibration button pressed" << std::endl; int ret = cameracalibration::calibrate( selected_camera_intrinsics.c_str(), squareWidth, markerWidth, - boardWidth, boardHeight, imagerWidth, imagerHeight, true); + boardWidth, boardHeight, imagerWidth, imagerHeight, showDebug); if (ret == 0) { size_t lastSeparatorPos = selected_camera_intrinsics.find_last_of("/\\"); @@ -381,7 +387,7 @@ static void DisplayGui() { std::cout << "calibration button pressed" << std::endl; int ret = cameracalibration::calibrate( selected_camera_intrinsics.c_str(), squareWidth, markerWidth, - boardWidth, boardHeight, true); + boardWidth, boardHeight, showDebug); if (ret == 0) { size_t lastSeparatorPos = selected_camera_intrinsics.find_last_of("/\\"); diff --git a/wpical/src/main/native/cpp/fieldcalibration.cpp b/wpical/src/main/native/cpp/fieldcalibration.cpp index d478aae033b..ed92b73241e 100644 --- a/wpical/src/main/native/cpp/fieldcalibration.cpp +++ b/wpical/src/main/native/cpp/fieldcalibration.cpp @@ -362,8 +362,10 @@ bool fieldcalibration::process_video_file( tag_detection_i, camera_matrix, camera_distortion, tag_size); // Draw debug cube - draw_tag_cube(frame_debug, caamera_to_tag, camera_matrix, - camera_distortion, tag_size); + if (show_debug_window) { + draw_tag_cube(frame_debug, caamera_to_tag, camera_matrix, + camera_distortion, tag_size); + } // Skip finding transformation from smallest tag ID to itself if (tag_detection_i->id == tag_detection_min->id) {