1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #27821 from savuor:rv/fix_nan_depth_scale

Fixed wrong NaN handling when scaling depth for OdometryFrame #27821

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Rostislav Vasilikhin
2025-09-25 14:25:04 +02:00
committed by GitHub
parent 4159c0ad98
commit cdea2c3f76
2 changed files with 68 additions and 4 deletions
+52
View File
@@ -79,6 +79,7 @@ public:
void run();
void checkUMats();
void prepareFrameCheck();
void processedDepthCheck();
OdometryType otype;
OdometryAlgoType algtype;
@@ -428,6 +429,32 @@ void OdometryTest::prepareFrameCheck()
}
}
void OdometryTest::processedDepthCheck()
{
Mat K = getCameraMatrix();
Mat gtImage, gtDepth;
readData(gtImage, gtDepth);
gtDepth *= 5000.0;
OdometrySettings ods;
ods.setCameraMatrix(K);
Odometry odometry = Odometry(otype, ods, algtype);
OdometryFrame odf(gtDepth, gtImage);
odometry.prepareFrame(odf);
Mat scaled;
odf.getProcessedDepth(scaled);
//TODO: remove this check when depth rescaling is removed
double pmax;
cv::minMaxLoc(scaled, nullptr, &pmax);
EXPECT_LT(pmax, 10.0);
}
/****************************************************************************************\
* Tests registrations *
\****************************************************************************************/
@@ -508,6 +535,31 @@ TEST(RGBD_Odometry_FastICP, prepareFrame)
}
TEST(RGBD_Odometry_Rgb, processedDepth)
{
OdometryTest test(OdometryType::RGB, OdometryAlgoType::COMMON, 0.99, 0.99);
test.processedDepthCheck();
}
TEST(RGBD_Odometry_ICP, processedDepth)
{
OdometryTest test(OdometryType::DEPTH, OdometryAlgoType::COMMON, 0.99, 0.99);
test.processedDepthCheck();
}
TEST(RGBD_Odometry_RgbdICP, processedDepth)
{
OdometryTest test(OdometryType::RGB_DEPTH, OdometryAlgoType::COMMON, 0.99, 0.99);
test.processedDepthCheck();
}
TEST(RGBD_Odometry_FastICP, processedDepth)
{
OdometryTest test(OdometryType::DEPTH, OdometryAlgoType::FAST, 0.99, 0.99, FLT_EPSILON);
test.processedDepthCheck();
}
struct WarpFrameTest
{
WarpFrameTest() :