From 282ab4b022198276aa94dc5e23f720684166a88a Mon Sep 17 00:00:00 2001 From: slz Date: Tue, 18 Aug 2026 15:13:52 +0800 Subject: [PATCH] fix: update color image layout on profile switch --- orbbec_camera/src/ob_camera_node.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index 3663e70a..1aa56019 100755 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -3933,6 +3933,12 @@ void OBCameraNode::updateImageConfig(const stream_index_pair &stream_index) { encoding_[stream_index] = is_depth_stream ? sensor_msgs::image_encodings::TYPE_16UC1 : sensor_msgs::image_encodings::MONO16; unit_step_size_[stream_index] = sizeof(uint16_t); + } else if (is_color_stream && + (format == OB_FORMAT_YUYV || format == OB_FORMAT_UYVY || format == OB_FORMAT_I420 || + format == OB_FORMAT_NV12 || format == OB_FORMAT_NV21)) { + image_format_[stream_index] = CV_8UC3; + encoding_[stream_index] = sensor_msgs::image_encodings::RGB8; + unit_step_size_[stream_index] = 3 * sizeof(uint8_t); } else if (format == OB_FORMAT_MJPG || format == OB_FORMAT_MJPEG) { if (is_ir_stream) { image_format_[stream_index] = CV_8UC1;