From 6546b8804f3b707d907b221d9138fd1f442a126d Mon Sep 17 00:00:00 2001 From: ob-yalian Date: Mon, 21 Sep 2026 22:24:28 +0800 Subject: [PATCH] fix: support automatic depth dimensions for Gemini 301 series --- orbbec_camera/src/ob_camera_node.cpp | 30 ++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index b7faff7f..9bfff5d7 100644 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -3622,15 +3622,33 @@ void OBCameraNode::setupProfiles() { if (is_playback_device_) { selected_profile = profiles->getProfile(0)->as(); } else if (width_[elem] == 0 && height_[elem] == 0 && fps_[elem] == 0 && - format_[elem] == OB_FORMAT_UNKNOWN) { + format_[elem] == OB_FORMAT_UNKNOWN && + !(isGemini301SeriesPID(pid_) && elem == DEPTH && + depth_decimation_factor_ != 1)) { selected_profile = profiles->getProfile(0)->as(); } else { if (isGemini301SeriesPID(pid_) && elem == DEPTH) { - OBHardwareDecimationConfig conf; - conf.originWidth = width_[elem]; - conf.originHeight = height_[elem]; - conf.factor = depth_decimation_factor_; - selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]); + if (width_[elem] == 0 || height_[elem] == 0) { + // The SDK decimation lookup requires exact origin dimensions, not wildcards. + for (const auto &profile : supported_profiles_[elem]) { + const auto conf = profile->getDecimationConfig(); + if ((width_[elem] == 0 || static_cast(conf.originWidth) == width_[elem]) && + (height_[elem] == 0 || + static_cast(conf.originHeight) == height_[elem]) && + static_cast(conf.factor) == depth_decimation_factor_ && + (format_[elem] == OB_FORMAT_ANY || profile->getFormat() == format_[elem]) && + (fps_[elem] == 0 || static_cast(profile->getFps()) == fps_[elem])) { + selected_profile = profile; + break; + } + } + } else { + OBHardwareDecimationConfig conf; + conf.originWidth = width_[elem]; + conf.originHeight = height_[elem]; + conf.factor = depth_decimation_factor_; + selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]); + } } else if (isGemini301SeriesPID(pid_) && elem == INFRA1) { OBHardwareDecimationConfig conf; conf.originWidth = width_[elem];