diff --git a/modules/3d/include/opencv2/3d/odometry_frame.hpp b/modules/3d/include/opencv2/3d/odometry_frame.hpp index f0c376c69c..d7362eea65 100644 --- a/modules/3d/include/opencv2/3d/odometry_frame.hpp +++ b/modules/3d/include/opencv2/3d/odometry_frame.hpp @@ -72,7 +72,7 @@ public: * * @param depth Output image */ - void getScaledDepth(OutputArray depth) const; + void getProcessedDepth(OutputArray depth) const; /** * @brief Get the valid pixels mask generated for the ICP calculations intersected with the user-provided mask * diff --git a/modules/3d/src/rgbd/odometry_frame_impl.cpp b/modules/3d/src/rgbd/odometry_frame_impl.cpp index 3bde589443..b1026d52a0 100644 --- a/modules/3d/src/rgbd/odometry_frame_impl.cpp +++ b/modules/3d/src/rgbd/odometry_frame_impl.cpp @@ -35,7 +35,7 @@ OdometryFrame::OdometryFrame(InputArray image, InputArray depth, InputArray mask void OdometryFrame::getImage(OutputArray image) const { this->impl->getImage(image); } void OdometryFrame::getGrayImage(OutputArray image) const { this->impl->getGrayImage(image); } void OdometryFrame::getDepth(OutputArray depth) const { this->impl->getDepth(depth); } -void OdometryFrame::getScaledDepth(OutputArray depth) const { this->impl->getScaledDepth(depth); } +void OdometryFrame::getProcessedDepth(OutputArray depth) const { this->impl->getProcessedDepth(depth); } void OdometryFrame::getMask(OutputArray mask) const { this->impl->getMask(mask); } void OdometryFrame::getNormals(OutputArray normals) const { this->impl->getNormals(normals); } @@ -61,7 +61,7 @@ void OdometryFrame::Impl::getDepth(OutputArray _depth) const _depth.assign(this->depth); } -void OdometryFrame::Impl::getScaledDepth(OutputArray _depth) const +void OdometryFrame::Impl::getProcessedDepth(OutputArray _depth) const { _depth.assign(this->scaledDepth); } diff --git a/modules/3d/src/rgbd/odometry_functions.cpp b/modules/3d/src/rgbd/odometry_functions.cpp index c395dee2e0..beb2683cb1 100644 --- a/modules/3d/src/rgbd/odometry_functions.cpp +++ b/modules/3d/src/rgbd/odometry_functions.cpp @@ -262,7 +262,7 @@ static void prepareRGBFrameBase(OdometryFrame& frame, OdometrySettings settings) //TODO: don't use scaled when scale bug is fixed UMat scaledDepth; - frame.getScaledDepth(scaledDepth); + frame.getProcessedDepth(scaledDepth); if (scaledDepth.empty()) { scaledDepth = prepareScaledDepth(frame); @@ -348,7 +348,7 @@ static void prepareICPFrameBase(OdometryFrame& frame, OdometrySettings settings) { //TODO: don't use scaled when scale bug is fixed UMat scaledDepth; - frame.getScaledDepth(scaledDepth); + frame.getProcessedDepth(scaledDepth); if (scaledDepth.empty()) { scaledDepth = prepareScaledDepth(frame); @@ -410,7 +410,7 @@ static void prepareICPFrameDst(OdometryFrame& frame, OdometrySettings settings, settings.getCameraMatrix(cameraMatrix); UMat scaledDepth, mask, normals; - frame.getScaledDepth(scaledDepth); + frame.getProcessedDepth(scaledDepth); frame.getMask(mask); frame.getNormals(normals); @@ -439,6 +439,7 @@ static void prepareICPFrameDst(OdometryFrame& frame, OdometrySettings settings, normalsComputer->apply(c0, normals); frame.impl->normals = normals; } + CV_Assert(normals.type() == CV_32FC4); const std::vector& dpyramids = frame.impl->pyramids[OdometryFramePyramidType::PYR_DEPTH]; diff --git a/modules/3d/src/rgbd/utils.hpp b/modules/3d/src/rgbd/utils.hpp index cca2e9464f..d935c98055 100644 --- a/modules/3d/src/rgbd/utils.hpp +++ b/modules/3d/src/rgbd/utils.hpp @@ -247,7 +247,7 @@ public: virtual void getImage(OutputArray image) const ; virtual void getGrayImage(OutputArray image) const ; virtual void getDepth(OutputArray depth) const ; - virtual void getScaledDepth(OutputArray depth) const ; + virtual void getProcessedDepth(OutputArray depth) const ; virtual void getMask(OutputArray mask) const ; virtual void getNormals(OutputArray normals) const ; diff --git a/modules/3d/test/test_odometry.cpp b/modules/3d/test/test_odometry.cpp index c67aeeaae8..941863a434 100644 --- a/modules/3d/test/test_odometry.cpp +++ b/modules/3d/test/test_odometry.cpp @@ -310,8 +310,7 @@ void OdometryTest::prepareFrameCheck() ASSERT_LE(grayNorm, 0.0); } - //TODO: remove it when scale issue is fixed - odf.getScaledDepth(scaled); + odf.getProcessedDepth(scaled); int scalednz = countNonZero(scaled); EXPECT_EQ(scalednz, depthnz);