Update perf_pnp && ransac model points
This commit is contained in:
parent
3c3d695d4d
commit
620387fbe1
@ -10,7 +10,7 @@ using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
CV_ENUM(pnpAlgo, SOLVEPNP_ITERATIVE, SOLVEPNP_EPNP, SOLVEPNP_DLS /*, P3P*/)
|
||||
CV_ENUM(pnpAlgo, SOLVEPNP_ITERATIVE, SOLVEPNP_EPNP, SOLVEPNP_P3P, SOLVEPNP_DLS)
|
||||
|
||||
typedef std::tr1::tuple<int, pnpAlgo> PointsNum_Algo_t;
|
||||
typedef perf::TestBaseWithParam<PointsNum_Algo_t> PointsNum_Algo;
|
||||
@ -20,7 +20,7 @@ typedef perf::TestBaseWithParam<int> PointsNum;
|
||||
PERF_TEST_P(PointsNum_Algo, solvePnP,
|
||||
testing::Combine(
|
||||
testing::Values(4, 3*9, 7*13), //TODO: find why results on 4 points are too unstable
|
||||
testing::Values((int)SOLVEPNP_ITERATIVE, (int)SOLVEPNP_EPNP, (int)SOLVEPNP_DLS)
|
||||
testing::Values((int)SOLVEPNP_ITERATIVE, (int)SOLVEPNP_EPNP)
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -62,9 +62,15 @@ PERF_TEST_P(PointsNum_Algo, solvePnP,
|
||||
SANITY_CHECK(tvec, 1e-6);
|
||||
}
|
||||
|
||||
PERF_TEST(PointsNum_Algo, solveP3P)
|
||||
PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints,
|
||||
testing::Combine(
|
||||
testing::Values(4), //TODO: find why results on 4 points are too unstable
|
||||
testing::Values((int)SOLVEPNP_P3P, (int)SOLVEPNP_DLS)
|
||||
)
|
||||
)
|
||||
{
|
||||
int pointsNum = 4;
|
||||
int pointsNum = get<0>(GetParam());
|
||||
pnpAlgo algo = get<1>(GetParam());
|
||||
|
||||
vector<Point2f> points2d(pointsNum);
|
||||
vector<Point3f> points3d(pointsNum);
|
||||
@ -94,11 +100,11 @@ PERF_TEST(PointsNum_Algo, solveP3P)
|
||||
|
||||
TEST_CYCLE_N(1000)
|
||||
{
|
||||
solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, SOLVEPNP_P3P);
|
||||
solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, algo);
|
||||
}
|
||||
|
||||
SANITY_CHECK(rvec, 1e-6);
|
||||
SANITY_CHECK(tvec, 1e-6);
|
||||
SANITY_CHECK(rvec, 1e-4);
|
||||
SANITY_CHECK(tvec, 1e-4);
|
||||
}
|
||||
|
||||
PERF_TEST_P(PointsNum, DISABLED_SolvePnPRansac, testing::Values(4, 3*9, 7*13))
|
||||
|
@ -203,7 +203,10 @@ bool cv::solvePnPRansac(InputArray _opoints, InputArray _ipoints,
|
||||
Ptr<PointSetRegistrator::Callback> cb; // pointer to callback
|
||||
cb = makePtr<PnPRansacCallback>( cameraMatrix, distCoeffs, flags, useExtrinsicGuess, rvec, tvec);
|
||||
|
||||
int model_points = flags == SOLVEPNP_P3P ? 4 : 6; // minimum of number of model points
|
||||
int model_points = 4; // minimum of number of model points
|
||||
if( flags == cv::SOLVEPNP_ITERATIVE ) model_points = 6;
|
||||
else if( flags == cv::SOLVEPNP_EPNP ) model_points = 5;
|
||||
|
||||
double param1 = reprojectionError; // reprojection error
|
||||
double param2 = confidence; // confidence
|
||||
int param3 = iterationsCount; // number maximum iterations
|
||||
|
Loading…
Reference in New Issue
Block a user