mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
Merge pull request #19044 from OrestChura:oc/fix_coverity_warn_kmeans
This commit is contained in:
commit
619cc01ca1
@ -44,7 +44,7 @@ PERF_TEST_P_(BuildOptFlowPyramidPerfTest, TestPerformance)
|
|||||||
outMaxLevelGAPI = static_cast<int>(outMaxLevelSc[0]);
|
outMaxLevelGAPI = static_cast<int>(outMaxLevelSc[0]);
|
||||||
|
|
||||||
// Comparison //////////////////////////////////////////////////////////////
|
// Comparison //////////////////////////////////////////////////////////////
|
||||||
compareOutputPyramids(outOCV, outGAPI);
|
compareOutputPyramids(outGAPI, outOCV);
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING();
|
SANITY_CHECK_NOTHING();
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ PERF_TEST_P_(OptFlowLKPerfTest, TestPerformance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comparison //////////////////////////////////////////////////////////////
|
// Comparison //////////////////////////////////////////////////////////////
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING();
|
SANITY_CHECK_NOTHING();
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ PERF_TEST_P_(OptFlowLKForPyrPerfTest, TestPerformance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comparison //////////////////////////////////////////////////////////////
|
// Comparison //////////////////////////////////////////////////////////////
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING();
|
SANITY_CHECK_NOTHING();
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ PERF_TEST_P_(BuildPyr_CalcOptFlow_PipelinePerfTest, TestPerformance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comparison //////////////////////////////////////////////////////////////
|
// Comparison //////////////////////////////////////////////////////////////
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING();
|
SANITY_CHECK_NOTHING();
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ namespace opencv_test
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
template <typename Elem>
|
template <typename Elem>
|
||||||
inline bool compareVectorsAbsExact(const std::vector<Elem>& outOCV,
|
inline bool compareVectorsAbsExact(const std::vector<Elem>& outGAPI,
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,26 +390,26 @@ inline GComputation runOCVnGAPIOptFlowPipeline(TestFunctional&,
|
|||||||
|
|
||||||
#endif // HAVE_OPENCV_VIDEO
|
#endif // HAVE_OPENCV_VIDEO
|
||||||
|
|
||||||
inline void compareOutputPyramids(const BuildOpticalFlowPyramidTestOutput& outOCV,
|
inline void compareOutputPyramids(const BuildOpticalFlowPyramidTestOutput& outGAPI,
|
||||||
const BuildOpticalFlowPyramidTestOutput& outGAPI)
|
const BuildOpticalFlowPyramidTestOutput& outOCV)
|
||||||
{
|
{
|
||||||
GAPI_Assert(outGAPI.maxLevel == outOCV.maxLevel);
|
GAPI_Assert(outGAPI.maxLevel == outOCV.maxLevel);
|
||||||
GAPI_Assert(outOCV.maxLevel >= 0);
|
GAPI_Assert(outOCV.maxLevel >= 0);
|
||||||
size_t maxLevel = static_cast<size_t>(outOCV.maxLevel);
|
size_t maxLevel = static_cast<size_t>(outOCV.maxLevel);
|
||||||
for (size_t i = 0; i <= maxLevel; i++)
|
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>
|
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,
|
inline void compareOutputsOptFlow(const OptFlowLKTestOutput& outGAPI,
|
||||||
const OptFlowLKTestOutput& outGAPI)
|
const OptFlowLKTestOutput& outOCV)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.nextPoints, outOCV.nextPoints));
|
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.nextPoints, outOCV.nextPoints));
|
||||||
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.statuses, outOCV.statuses));
|
EXPECT_TRUE(compareVectorsAbsExactForOptFlow(outGAPI.statuses, outOCV.statuses));
|
||||||
|
@ -27,7 +27,7 @@ TEST_P(BuildOptFlowPyramidTest, AccuracyTest)
|
|||||||
|
|
||||||
runOCVnGAPIBuildOptFlowPyramid(*this, params, outOCV, outGAPI);
|
runOCVnGAPIBuildOptFlowPyramid(*this, params, outOCV, outGAPI);
|
||||||
|
|
||||||
compareOutputPyramids(outOCV, outGAPI);
|
compareOutputPyramids(outGAPI, outOCV);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(OptFlowLKTest, AccuracyTest)
|
TEST_P(OptFlowLKTest, AccuracyTest)
|
||||||
@ -44,7 +44,7 @@ TEST_P(OptFlowLKTest, AccuracyTest)
|
|||||||
|
|
||||||
runOCVnGAPIOptFlowLK(*this, inPts, params, outOCV, outGAPI);
|
runOCVnGAPIOptFlowLK(*this, inPts, params, outOCV, outGAPI);
|
||||||
|
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(OptFlowLKTestForPyr, AccuracyTest)
|
TEST_P(OptFlowLKTestForPyr, AccuracyTest)
|
||||||
@ -63,7 +63,7 @@ TEST_P(OptFlowLKTestForPyr, AccuracyTest)
|
|||||||
|
|
||||||
runOCVnGAPIOptFlowLKForPyr(*this, in, params, withDeriv, outOCV, outGAPI);
|
runOCVnGAPIOptFlowLKForPyr(*this, in, params, withDeriv, outOCV, outGAPI);
|
||||||
|
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
|
TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
|
||||||
@ -86,7 +86,7 @@ TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
|
|||||||
|
|
||||||
runOCVnGAPIOptFlowPipeline(*this, params, outOCV, outGAPI, inPts);
|
runOCVnGAPIOptFlowPipeline(*this, params, outOCV, outGAPI, inPts);
|
||||||
|
|
||||||
compareOutputsOptFlow(outOCV, outGAPI);
|
compareOutputsOptFlow(outGAPI, outOCV);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCV_VIDEO
|
#ifdef HAVE_OPENCV_VIDEO
|
||||||
|
Loading…
Reference in New Issue
Block a user