warpFrame test parametrized

This commit is contained in:
Rostislav Vasilikhin 2022-07-24 18:22:48 +02:00
parent 75a8e3e956
commit d4e28f27b7

View File

@ -534,24 +534,18 @@ void WarpFrameTest::run(bool needRgb, bool scaleDown, bool checkMask, bool ident
warpFrame(srcDepth, srcRgb, srcMask, rt.matrix, K, dstDepth, dstRgb, dstMask);
}
typedef std::pair<int, int> WarpFrameInputTypes;
typedef testing::TestWithParam<WarpFrameInputTypes> WarpFrameInputs;
TEST(RGBD_Odometry_WarpFrame, inputTypes)
TEST_P(WarpFrameInputs, checkTypes)
{
// [depthType, rgbType]
std::array<int, 5*2> types =
{ CV_16U, CV_8UC3,
CV_32F, CV_8UC3,
CV_64F, CV_8UC3,
CV_32F, CV_8UC1,
CV_32F, CV_8UC4 };
const double shortl2diff = 233.983;
const double shortlidiff = 1;
const double floatl2diff = 0.038209;
const double floatlidiff = 0.00020004;
for (int i = 0; i < 5; i++)
{
int depthType = types[i*2 + 0];
int rgbType = types[i*2 + 1];
int depthType = GetParam().first;
int rgbType = GetParam().second;
WarpFrameTest w;
// scale down does not happen on CV_16U
@ -574,7 +568,14 @@ TEST(RGBD_Odometry_WarpFrame, inputTypes)
EXPECT_GE(l2threshold, l2diff);
EXPECT_GE(lithreshold, lidiff);
}
}
INSTANTIATE_TEST_CASE_P(RGBD_Odometry, WarpFrameInputs, ::testing::Values(
WarpFrameInputTypes { CV_16U, CV_8UC3 },
WarpFrameInputTypes { CV_32F, CV_8UC3 },
WarpFrameInputTypes { CV_64F, CV_8UC3 },
WarpFrameInputTypes { CV_32F, CV_8UC1 },
WarpFrameInputTypes { CV_32F, CV_8UC4 }));
TEST(RGBD_Odometry_WarpFrame, identity)
{