diff --git a/src/ds/d500/d500-device.cpp b/src/ds/d500/d500-device.cpp index d456ab0123..843585f891 100644 --- a/src/ds/d500/d500-device.cpp +++ b/src/ds/d500/d500-device.cpp @@ -286,8 +286,18 @@ namespace librealsense float d500_device::get_stereo_baseline_mm() const // to be d500 adapted { using namespace ds; - auto table = check_calib(*_coefficients_table_raw); - return fabs(table->baseline); + float baseline = 100.0f; // so we will have a non zero value if cannot read from table + try + { + auto table = check_calib(*_coefficients_table_raw); + baseline = fabs(table->baseline); + } + catch( const std::exception &e ) + { + LOG_ERROR("Failed reading stereo baseline, using default value --> " << e.what() ); + } + + return baseline; } std::vector d500_device::get_d500_raw_calibration_table(ds::d500_calibration_table_id table_id) const // to be d500 adapted diff --git a/src/ds/d500/d500-private.cpp b/src/ds/d500/d500-private.cpp index fb597f8d0e..0dfb39977d 100644 --- a/src/ds/d500/d500-private.cpp +++ b/src/ds/d500/d500-private.cpp @@ -47,15 +47,29 @@ namespace librealsense { case d500_calibration_table_id::depth_calibration_id: { - return get_d500_depth_intrinsic_by_resolution(raw_data, width, height, is_symmetrization_enabled); + if ( !raw_data.empty() ) + return get_d500_depth_intrinsic_by_resolution(raw_data, width, height, is_symmetrization_enabled); + else + LOG_ERROR("Cannot read depth table intrinsic values, using default values"); } case d500_calibration_table_id::rgb_calibration_id: { - return get_d500_color_intrinsic_by_resolution(raw_data, width, height); + if ( !raw_data.empty() ) + return get_d500_color_intrinsic_by_resolution(raw_data, width, height); + else + LOG_ERROR("Cannot read color table intrinsic values, using default values"); } default: throw invalid_value_exception(rsutils::string::from() << "Parsing Calibration table type " << static_cast(table_id) << " is not supported"); } + + // If we got here, the table is empty so continue with default values + rs2_intrinsics intrinsics = {0}; + intrinsics.height = height; + intrinsics.width = width; + intrinsics.ppx = intrinsics.fx = width / 2.f; + intrinsics.ppy = intrinsics.fy = height / 2.f; + return intrinsics; } // Algorithm prepared by Oscar Pelc in matlab: