Make performance tests for solvePnPRansec more determenistic
This commit is contained in:
parent
d4cf9e22cc
commit
5a5c477be6
@ -1,4 +1,5 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "opencv2/core/internal.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
@ -48,7 +49,10 @@ PERF_TEST_P(PointsNum_Algo, solvePnP,
|
||||
|
||||
declare.in(points3d, points2d);
|
||||
|
||||
TEST_CYCLE_N(1000) solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, algo);
|
||||
TEST_CYCLE_N(1000)
|
||||
{
|
||||
solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, algo);
|
||||
}
|
||||
|
||||
SANITY_CHECK(rvec, 1e-6);
|
||||
SANITY_CHECK(tvec, 1e-6);
|
||||
@ -83,7 +87,10 @@ PERF_TEST(PointsNum_Algo, solveP3P)
|
||||
|
||||
declare.in(points3d, points2d);
|
||||
|
||||
TEST_CYCLE_N(1000) solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, CV_P3P);
|
||||
TEST_CYCLE_N(1000)
|
||||
{
|
||||
solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, CV_P3P);
|
||||
}
|
||||
|
||||
SANITY_CHECK(rvec, 1e-6);
|
||||
SANITY_CHECK(tvec, 1e-6);
|
||||
@ -117,9 +124,10 @@ PERF_TEST_P(PointsNum, SolvePnPRansac, testing::Values(4, 3*9, 7*13))
|
||||
Mat rvec;
|
||||
Mat tvec;
|
||||
|
||||
solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
||||
|
||||
declare.time(3.0);
|
||||
#ifdef HAVE_TBB
|
||||
// limit concurrency to get determenistic result
|
||||
cv::Ptr<tbb::task_scheduler_init> one_thread = new tbb::task_scheduler_init(1);
|
||||
#endif
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
|
@ -260,6 +260,8 @@ namespace cv
|
||||
{
|
||||
rvec.copyTo(initRvec);
|
||||
tvec.copyTo(initTvec);
|
||||
|
||||
generator.state = theRNG().state; //to control it somehow...
|
||||
}
|
||||
private:
|
||||
PnPSolver& operator=(const PnPSolver&);
|
||||
|
@ -674,6 +674,8 @@ cv::Size TestBase::getSize(cv::InputArray a)
|
||||
bool TestBase::next()
|
||||
{
|
||||
bool has_next = ++currentIter < nIters && totalTime < timeLimit;
|
||||
cv::theRNG().state = param_seed; //this rng should generate same numbers for each run
|
||||
|
||||
#ifdef ANDROID
|
||||
if (log_power_checkpoints)
|
||||
{
|
||||
@ -948,7 +950,6 @@ void TestBase::SetUp()
|
||||
currentIter = (unsigned int)-1;
|
||||
timeLimit = timeLimitDefault;
|
||||
times.clear();
|
||||
cv::theRNG().state = param_seed;//this rng should generate same numbers for each run
|
||||
}
|
||||
|
||||
void TestBase::TearDown()
|
||||
|
Loading…
Reference in New Issue
Block a user