From 34e1af7e223d3ed6dfe7b9e7a426c03c5f833221 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Thu, 19 Nov 2020 10:36:08 -0500 Subject: [PATCH] RealSense2: added error message for L515 if resolution is not 640x480 30 fps (#629) --- corelib/src/camera/CameraRealSense2.cpp | 52 ++++++++++++++----------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/corelib/src/camera/CameraRealSense2.cpp b/corelib/src/camera/CameraRealSense2.cpp index 2d42ffc7..e6127e17 100644 --- a/corelib/src/camera/CameraRealSense2.cpp +++ b/corelib/src/camera/CameraRealSense2.cpp @@ -656,31 +656,33 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st auto video_profile = profile.as(); if(!stereo) { - if(isL500_ - && (video_profile.width() == 640 && - video_profile.height() == 480 && - video_profile.fps() == 30)) + if(isL500_) { - if( i==0 // rgb - && video_profile.format() == RS2_FORMAT_RGB8 && video_profile.stream_type() == RS2_STREAM_COLOR) + if(video_profile.width() == 640 && + video_profile.height() == 480 && + video_profile.fps() == 30) { - auto intrinsic = video_profile.get_intrinsics(); - profilesPerSensor[i].push_back(profile); - rgbBuffer_ = cv::Mat(cv::Size(video_profile.width(), video_profile.height()), CV_8UC3, cv::Scalar(0, 0, 0)); - model_ = CameraModel(camera_name, intrinsic.fx, intrinsic.fy, intrinsic.ppx, intrinsic.ppy, this->getLocalTransform(), 0, cv::Size(intrinsic.width, intrinsic.height)); - rgbStreamProfile = profile; - *rgbIntrinsics_ = intrinsic; - added = true; - } - else if( i==1 // depth - && video_profile.format() == RS2_FORMAT_Z16 && video_profile.stream_type() == RS2_STREAM_DEPTH) - { - auto intrinsic = video_profile.get_intrinsics(); - profilesPerSensor[i].push_back(profile); - depthBuffer_ = cv::Mat(cv::Size(video_profile.width(), video_profile.height()), CV_16UC1, cv::Scalar(0)); - depthStreamProfile = profile; - *depthIntrinsics_ = intrinsic; - added = true; + if( i==0 // rgb + && video_profile.format() == RS2_FORMAT_RGB8 && video_profile.stream_type() == RS2_STREAM_COLOR) + { + auto intrinsic = video_profile.get_intrinsics(); + profilesPerSensor[i].push_back(profile); + rgbBuffer_ = cv::Mat(cv::Size(video_profile.width(), video_profile.height()), CV_8UC3, cv::Scalar(0, 0, 0)); + model_ = CameraModel(camera_name, intrinsic.fx, intrinsic.fy, intrinsic.ppx, intrinsic.ppy, this->getLocalTransform(), 0, cv::Size(intrinsic.width, intrinsic.height)); + rgbStreamProfile = profile; + *rgbIntrinsics_ = intrinsic; + added = true; + } + else if( i==1 // depth + && video_profile.format() == RS2_FORMAT_Z16 && video_profile.stream_type() == RS2_STREAM_DEPTH) + { + auto intrinsic = video_profile.get_intrinsics(); + profilesPerSensor[i].push_back(profile); + depthBuffer_ = cv::Mat(cv::Size(video_profile.width(), video_profile.height()), CV_16UC1, cv::Scalar(0)); + depthStreamProfile = profile; + *depthIntrinsics_ = intrinsic; + added = true; + } } } //D400 series: @@ -820,6 +822,10 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st video_profile.stream_name().c_str(), video_profile.stream_type()); } + if(isL500_) + { + UERROR("L500 sensor is detected, note that only 640x480:30FPS configuration is currently supported."); + } return false; } }