2019-07-19 03:15:14 +08:00
|
|
|
// This file is part of OpenCV project.
|
|
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
|
|
// of this distribution and at http://opencv.org/license.html
|
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
2022-04-24 05:42:17 +08:00
|
|
|
namespace opencv_test { namespace {
|
2021-05-29 04:47:36 +08:00
|
|
|
|
2022-05-24 03:37:16 +08:00
|
|
|
PERF_TEST(Undistort, fisheye_undistortPoints_100k_10iter)
|
2022-04-20 02:07:34 +08:00
|
|
|
{
|
2022-05-24 03:37:16 +08:00
|
|
|
const int pointsNumber = 100000;
|
|
|
|
const Size imageSize(1280, 800);
|
2022-04-20 02:07:34 +08:00
|
|
|
|
|
|
|
/* Set camera matrix */
|
2022-05-24 03:37:16 +08:00
|
|
|
const Matx33d K(558.478087865323, 0, 620.458515360843,
|
2022-04-20 02:07:34 +08:00
|
|
|
0, 560.506767351568, 381.939424848348,
|
|
|
|
0, 0, 1);
|
|
|
|
|
|
|
|
/* Set distortion coefficients */
|
2022-05-24 03:37:16 +08:00
|
|
|
const Matx14d D(2.81e-06, 1.31e-06, -4.42e-06, -1.25e-06);
|
2022-04-20 02:07:34 +08:00
|
|
|
|
|
|
|
/* Create two-channel points matrix */
|
2022-05-24 03:37:16 +08:00
|
|
|
Mat xy[2] = {};
|
2022-04-20 02:07:34 +08:00
|
|
|
xy[0].create(pointsNumber, 1, CV_64F);
|
2022-05-24 03:37:16 +08:00
|
|
|
theRNG().fill(xy[0], RNG::UNIFORM, 0, imageSize.width); // x
|
2022-04-20 02:07:34 +08:00
|
|
|
xy[1].create(pointsNumber, 1, CV_64F);
|
2022-05-24 03:37:16 +08:00
|
|
|
theRNG().fill(xy[1], RNG::UNIFORM, 0, imageSize.height); // y
|
2022-04-20 02:07:34 +08:00
|
|
|
|
2022-05-24 03:37:16 +08:00
|
|
|
Mat points;
|
2022-04-20 02:07:34 +08:00
|
|
|
merge(xy, 2, points);
|
|
|
|
|
|
|
|
/* Set fixed iteration number to check only c++ code, not algo convergence */
|
|
|
|
TermCriteria termCriteria(TermCriteria::MAX_ITER, 10, 0);
|
|
|
|
|
|
|
|
Mat undistortedPoints;
|
|
|
|
TEST_CYCLE() fisheye::undistortPoints(points, undistortedPoints, K, D, noArray(), noArray(), termCriteria);
|
|
|
|
|
|
|
|
SANITY_CHECK_NOTHING();
|
|
|
|
}
|
|
|
|
|
2022-04-24 05:42:17 +08:00
|
|
|
}} // namespace
|