From 6577433d7ae01d38722472f0f7c94483870f2ae9 Mon Sep 17 00:00:00 2001 From: ohadmeir Date: Thu, 28 Nov 2024 16:10:06 +0200 Subject: [PATCH] Prevent depth calibration profile to be selected in DQT --- common/subdevice-model.cpp | 39 +++++++++++++++++++++ common/subdevice-model.h | 2 ++ tools/depth-quality/depth-quality-model.cpp | 3 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/common/subdevice-model.cpp b/common/subdevice-model.cpp index b4dbf10ce5..f2054414a0 100644 --- a/common/subdevice-model.cpp +++ b/common/subdevice-model.cpp @@ -1419,6 +1419,45 @@ namespace rs2 return is_cal_format; } + bool subdevice_model::is_depth_calibration_profile() const + { + // Check if D555 at depth resolution of 1280x800 + std::string dev_name = ""; + if( dev.supports( RS2_CAMERA_INFO_NAME ) ) + dev_name = dev.get_info( RS2_CAMERA_INFO_NAME ); + + if( dev_name.find( "D555" ) != std::string::npos ) + { + // More efficient to check resolution before format + if( ui.selected_res_id > 0 && res_values.size() > ui.selected_res_id && // Verify res_values is initialized + res_values[ui.selected_res_id].first == 1280 && res_values[ui.selected_res_id].second == 800 ) + { + for( auto it = stream_enabled.begin(); it != stream_enabled.end(); ++it ) + { + if( it->second ) + { + int selected_format_index = -1; + if( ui.selected_format_id.count( it->first ) > 0 ) + selected_format_index = ui.selected_format_id.at( it->first ); + + if( format_values.count( it->first ) > 0 && selected_format_index > -1 ) + { + auto formats = format_values.at( it->first ); + if( formats.size() > selected_format_index ) + { + auto format = formats[selected_format_index]; + if( format == RS2_FORMAT_Z16 ) + return true; + } + } + } + } + } + } + + return false; + } + std::pair subdevice_model::get_max_resolution(rs2_stream stream) const { if (resolutions_per_stream.count(stream) > 0) diff --git a/common/subdevice-model.h b/common/subdevice-model.h index 2d25151037..6688cf8540 100644 --- a/common/subdevice-model.h +++ b/common/subdevice-model.h @@ -138,6 +138,8 @@ namespace rs2 return false; } + bool is_depth_calibration_profile() const; + viewer_model& viewer; std::function on_frame = [] {}; diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index db65524c1b..07da2d059e 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -550,7 +550,8 @@ namespace rs2 if (_depth_sensor_model->draw_stream_selection(_error_message)) { - if (_depth_sensor_model->is_selected_combination_supported()) + if (_depth_sensor_model->is_selected_combination_supported() && + !_depth_sensor_model->is_depth_calibration_profile()) { // Preserve streams and ui selections auto primary = _depth_sensor_model->get_selected_profiles().front().as();