From 2047abd9c3445f076768c9e61c1db93f4438b346 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Tue, 19 Jun 2018 17:55:02 +0200 Subject: [PATCH] videoio: realsense - add cvtColor as the pixel-format is only a hint --- modules/videoio/src/cap_librealsense.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/videoio/src/cap_librealsense.cpp b/modules/videoio/src/cap_librealsense.cpp index a33841bab6..4ef1c76f71 100644 --- a/modules/videoio/src/cap_librealsense.cpp +++ b/modules/videoio/src/cap_librealsense.cpp @@ -85,6 +85,9 @@ bool VideoCapture_LibRealsense::retrieveFrame(int outputType, cv::OutputArray fr // we copy the data straight away, so const_cast should be fine void* data = const_cast(_frame.get_data()); Mat(_frame.get_height(), _frame.get_width(), type, data, _frame.get_stride_in_bytes()).copyTo(frame); + + if(_frame.get_profile().format() == RS2_FORMAT_RGB8) + cvtColor(frame, frame, COLOR_RGB2BGR); } catch (const rs2::error&) {