RealSense: added depthScaledToRGBSize option to be able to feed ORB_SLAM2 with depth and RGB images with same size #287.

This commit is contained in:
matlabbe
2018-06-19 13:53:03 -04:00
parent c91431410e
commit 973bf93c77
5 changed files with 41 additions and 8 deletions

View File

@@ -2623,6 +2623,7 @@ CameraRealSense::CameraRealSense(
presetRGB_(presetRGB),
presetDepth_(presetDepth),
computeOdometry_(computeOdometry),
depthScaledToRGBSize_(false),
slam_(0)
#endif
{
@@ -3132,7 +3133,8 @@ SensorData CameraRealSense::captureImage(CameraInfo * info)
cv::Mat depth;
if (color_intrin.width % depth_intrin.width == 0 && color_intrin.height % depth_intrin.height == 0 &&
depth_intrin.width < color_intrin.width &&
depth_intrin.height < color_intrin.height)
depth_intrin.height < color_intrin.height &&
!depthScaledToRGBSize_)
{
//we can keep the depth image size as is
depth = cv::Mat::zeros(cv::Size(depth_intrin.width, depth_intrin.height), CV_16UC1);

View File

@@ -859,7 +859,8 @@ Transform OdometryORBSLAM2::computeTransform(
data.imageRaw().rows != data.depthOrRightRaw().rows ||
data.imageRaw().cols != data.depthOrRightRaw().cols)
{
UERROR("Not supported input!");
UERROR("Not supported input! RGB (%dx%d) and depth (%dx%d) should have the same size.",
data.imageRaw().cols, data.imageRaw().rows, data.depthOrRightRaw().cols, data.depthOrRightRaw().rows);
return t;
}