Merge pull request #19044 from OrestChura:oc/fix_coverity_warn_kmeans

This commit is contained in:
Alexander Alekhin 2020-12-08 10:31:31 +00:00
commit 619cc01ca1
4 changed files with 18 additions and 18 deletions

View File

@ -44,7 +44,7 @@ PERF_TEST_P_(BuildOptFlowPyramidPerfTest, TestPerformance)
outMaxLevelGAPI = static_cast<int>(outMaxLevelSc[0]);
// Comparison //////////////////////////////////////////////////////////////
compareOutputPyramids(outOCV, outGAPI);
compareOutputPyramids(outGAPI, outOCV);
SANITY_CHECK_NOTHING();
}
@ -74,7 +74,7 @@ PERF_TEST_P_(OptFlowLKPerfTest, TestPerformance)
}
// Comparison //////////////////////////////////////////////////////////////
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
SANITY_CHECK_NOTHING();
}
@ -109,7 +109,7 @@ PERF_TEST_P_(OptFlowLKForPyrPerfTest, TestPerformance)
}
// Comparison //////////////////////////////////////////////////////////////
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
SANITY_CHECK_NOTHING();
}
@ -147,7 +147,7 @@ PERF_TEST_P_(BuildPyr_CalcOptFlow_PipelinePerfTest, TestPerformance)
}
// Comparison //////////////////////////////////////////////////////////////
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
SANITY_CHECK_NOTHING();
}

View File

@ -18,10 +18,10 @@ namespace opencv_test
namespace
{
template <typename Elem>
inline bool compareVectorsAbsExact(const std::vector<Elem>& outOCV,
const std::vector<Elem>& outGAPI)
inline bool compareVectorsAbsExact(const std::vector<Elem>& outGAPI,
const std::vector<Elem>& outOCV)
{
return AbsExactVector<Elem>().to_compare_f()(outOCV, outGAPI);
return AbsExactVector<Elem>().to_compare_f()(outGAPI, outOCV);
}
}

View File

@ -390,26 +390,26 @@ inline GComputation runOCVnGAPIOptFlowPipeline(TestFunctional&,
#endif // HAVE_OPENCV_VIDEO
inline void compareOutputPyramids(const BuildOpticalFlowPyramidTestOutput& outOCV,
const BuildOpticalFlowPyramidTestOutput& outGAPI)
inline void compareOutputPyramids(const BuildOpticalFlowPyramidTestOutput& outGAPI,
const BuildOpticalFlowPyramidTestOutput& outOCV)
{
GAPI_Assert(outGAPI.maxLevel == outOCV.maxLevel);
GAPI_Assert(outOCV.maxLevel >= 0);
size_t maxLevel = static_cast<size_t>(outOCV.maxLevel);
for (size_t i = 0; i <= maxLevel; i++)
{
EXPECT_TRUE(AbsExact().to_compare_f()(outOCV.pyramid[i], outGAPI.pyramid[i]));
EXPECT_TRUE(AbsExact().to_compare_f()(outGAPI.pyramid[i], outOCV.pyramid[i]));
}
}
template <typename Elem>
inline bool compareVectorsAbsExactForOptFlow(std::vector<Elem> outOCV, std::vector<Elem> outGAPI)
inline bool compareVectorsAbsExactForOptFlow(std::vector<Elem> outGAPI, std::vector<Elem> outOCV)
{
return AbsExactVector<Elem>().to_compare_f()(outOCV, outGAPI);
return AbsExactVector<Elem>().to_compare_f()(outGAPI, outOCV);
}
inline void compareOutputsOptFlow(const OptFlowLKTestOutput& outOCV,
const OptFlowLKTestOutput& outGAPI)
inline void compareOutputsOptFlow(const OptFlowLKTestOutput& outGAPI,
const OptFlowLKTestOutput& outOCV)
{
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.nextPoints, outOCV.nextPoints));
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.statuses, outOCV.statuses));

View File

@ -27,7 +27,7 @@ TEST_P(BuildOptFlowPyramidTest, AccuracyTest)
runOCVnGAPIBuildOptFlowPyramid(*this, params, outOCV, outGAPI);
compareOutputPyramids(outOCV, outGAPI);
compareOutputPyramids(outGAPI, outOCV);
}
TEST_P(OptFlowLKTest, AccuracyTest)
@ -44,7 +44,7 @@ TEST_P(OptFlowLKTest, AccuracyTest)
runOCVnGAPIOptFlowLK(*this, inPts, params, outOCV, outGAPI);
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
}
TEST_P(OptFlowLKTestForPyr, AccuracyTest)
@ -63,7 +63,7 @@ TEST_P(OptFlowLKTestForPyr, AccuracyTest)
runOCVnGAPIOptFlowLKForPyr(*this, in, params, withDeriv, outOCV, outGAPI);
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
}
TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
@ -86,7 +86,7 @@ TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
runOCVnGAPIOptFlowPipeline(*this, params, outOCV, outGAPI, inPts);
compareOutputsOptFlow(outOCV, outGAPI);
compareOutputsOptFlow(outGAPI, outOCV);
}
#ifdef HAVE_OPENCV_VIDEO