Merge pull request #23189 from alalek:5.x-merge-4.x

This commit is contained in:
Alexander Alekhin 2023-01-30 05:32:39 +00:00
commit e880d51e1c
3 changed files with 38 additions and 37 deletions

View File

@ -181,10 +181,7 @@ protected:
depth = std::get<0>(std::get<0>(p));
alg = static_cast<RgbdNormals::RgbdNormalsMethod>(int(std::get<1>(std::get<0>(p))));
scale = std::get<2>(std::get<0>(p));
int idx = std::get<1>(p);
rng = cvtest::TS::ptr()->get_rng();
rng.state += idx + nTestCasesNormals*int(scale) + alg*16 + depth*64;
idx = std::get<1>(p);
float diffThreshold = scale ? 100000.f : 50.f;
normalsComputer = RgbdNormals::create(H, W, depth, K, 5, diffThreshold, alg);
@ -222,6 +219,9 @@ protected:
void runCase(bool scaleUp, int nPlanes, bool makeDepth,
double meanThreshold, double maxThreshold, double threshold3d)
{
RNG& rng = cv::theRNG();
rng.state += idx + nTestCasesNormals*int(scale) + alg*16 + depth*64;
std::vector<Plane> plane_params;
Mat_<unsigned char> plane_mask;
Mat points3d, ground_normals;
@ -277,8 +277,8 @@ protected:
int depth;
RgbdNormals::RgbdNormalsMethod alg;
bool scale;
int idx;
RNG rng;
Ptr<RgbdNormals> normalsComputer;
};
@ -339,7 +339,7 @@ INSTANTIATE_TEST_CASE_P(RGBD_Normals, NormalsRandomPlanes,
// 3 normal computer params + 5 thresholds:
//depth, alg, scale, 1plane mean, 1plane max, 3planes mean, 1plane16u mean, 3planes16 mean
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_FALS, true, 0.00362, 0.08881, 0.02175, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_FALS, false, 0.00374, 0.10309, 0.01902, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_FALS, false, 0.00374, 0.10309, 0.02, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_FALS, true, 0.00023, 0.00037, 0.01805, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_FALS, false, 0.00023, 0.00037, 0.01805, 0, 0},
@ -348,10 +348,10 @@ INSTANTIATE_TEST_CASE_P(RGBD_Normals, NormalsRandomPlanes,
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_LINEMOD, true, 0.00160, 0.06526, 0.04371, 0.28837, 0.28918},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_LINEMOD, false, 0.00154, 0.06877, 0.04323, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, true, 0.01987, hpi, 0.03463, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, false, 0.01962, hpi, 0.03546, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, true, 0.01958, hpi, 0.03546, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, false, 0.01995, hpi, 0.03474, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, true, 0.01987, hpi, 0.036, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, false, 0.01962, hpi, 0.037, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, true, 0.01958, hpi, 0.037, 0, 0},
NormalsTestData {CV_64F, RgbdNormals::RGBD_NORMALS_METHOD_SRI, false, 0.01995, hpi, 0.036, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_CROSS_PRODUCT, true, 0.000230, 0.00038, 0.00450, 0, 0},
NormalsTestData {CV_32F, RgbdNormals::RGBD_NORMALS_METHOD_CROSS_PRODUCT, false, 0.000230, 0.00038, 0.00478, 0, 0},

View File

@ -1114,12 +1114,13 @@ void VolumeTestFixture::valid_points_test()
displayImage(depth, points2, normals2, depthFactor, lightPose);
}
// TODO: why profile == 2*enface ?
float percentValidity = float(enface) / float(profile);
ASSERT_GT(profile, 0) << "There are no points in profile";
ASSERT_GT(enface, 0) << "There are no points in enface";
ASSERT_LT(abs(0.5 - percentValidity), 0.05) << "percentValidity should be in range 45-55%, but it's " << percentValidity*100.f << "%";
// TODO: why profile == 2*enface ?
float percentValidity = float(enface) / float(profile) * 100;
ASSERT_NEAR(percentValidity, 50, 6);
}
TEST_P(VolumeTestFixture, valid_points)

View File

@ -56,7 +56,7 @@ void Core_MathTest::get_test_array_types_and_sizes( int test_case_idx,
vector<vector<Size> >& sizes,
vector<vector<int> >& types)
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int depth = cvtest::randInt(rng)%2 + CV_32F;
int cn = cvtest::randInt(rng) % 4 + 1, type = CV_MAKETYPE(depth, cn);
size_t i, j;
@ -101,7 +101,7 @@ void Core_PowTest::get_test_array_types_and_sizes( int test_case_idx,
vector<vector<Size> >& sizes,
vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int depth = cvtest::randInt(rng) % (CV_64F+1);
int cn = cvtest::randInt(rng) % 4 + 1;
size_t i, j;
@ -135,14 +135,14 @@ double Core_PowTest::get_success_error_level( int test_case_idx, int i, int j )
return power == cvRound(power) && power >= 0 ? 0 : 1;
else
{
return depth != CV_64F ? Base::get_success_error_level( test_case_idx, i, j ) : DBL_EPSILON*1024*1.1;
return depth != CV_64F ? Base::get_success_error_level( test_case_idx, i, j ) : DBL_EPSILON*4096;
}
}
void Core_PowTest::get_minmax_bounds( int /*i*/, int /*j*/, int type, Scalar& low, Scalar& high )
{
double l, u = cvtest::randInt(ts->get_rng())%1000 + 1;
double l, u = cvtest::randInt(cv::theRNG())%1000 + 1;
if( power > 0 )
{
double mval = cvtest::getMaxVal(type);
@ -398,7 +398,7 @@ void Core_MatrixTest::get_test_array_types_and_sizes( int test_case_idx,
vector<vector<Size> >& sizes,
vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int depth = cvtest::randInt(rng) % (allow_int ? CV_64F+1 : 2);
int cn = cvtest::randInt(rng) % max_cn + 1;
size_t i, j;
@ -523,7 +523,7 @@ void Core_CrossProductTest::get_test_array_types_and_sizes( int,
vector<vector<Size> >& sizes,
vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int depth = cvtest::randInt(rng) % 2 + CV_32F;
int cn = cvtest::randInt(rng) & 1 ? 3 : 1, type = CV_MAKETYPE(depth, cn);
Size sz;
@ -628,7 +628,7 @@ Core_GEMMTest::Core_GEMMTest() : Core_MatrixTest( 5, 1, false, false, 2 )
void Core_GEMMTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
Size sizeA;
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
sizeA = sizes[INPUT][0];
@ -741,7 +741,7 @@ Core_MulTransposedTest::Core_MulTransposedTest() : Core_MatrixTest( 2, 1, false,
void Core_MulTransposedTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
int src_type = cvtest::randInt(rng) % 5;
int dst_type = cvtest::randInt(rng) % 2;
@ -838,7 +838,7 @@ Core_TransformTest::Core_TransformTest() : Core_MatrixTest( 3, 1, true, false, 4
void Core_TransformTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
int depth, dst_cn, mat_cols, mattype;
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
@ -924,7 +924,7 @@ protected:
void Core_TransformLargeTest::get_test_array_types_and_sizes(int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types)
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
int depth, dst_cn, mat_cols, mattype;
Base::get_test_array_types_and_sizes(test_case_idx, sizes, types);
@ -990,7 +990,7 @@ Core_PerspectiveTransformTest::Core_PerspectiveTransformTest() : Core_MatrixTest
void Core_PerspectiveTransformTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
int depth, cn, mattype;
Core_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
@ -1152,7 +1152,7 @@ Core_MahalanobisTest::Core_MahalanobisTest() : Core_MatrixTest( 3, 1, false, tru
void Core_MahalanobisTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
Core_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
if( cvtest::randInt(rng) & 1 )
@ -1232,7 +1232,7 @@ Core_CovarMatrixTest::Core_CovarMatrixTest() : Core_MatrixTest( 1, 1, true, fals
void Core_CovarMatrixTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
int i, single_matrix;
Core_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
@ -1442,7 +1442,7 @@ int Core_DetTest::prepare_test_case( int test_case_idx )
{
int code = Core_MatrixTest::prepare_test_case( test_case_idx );
if( code > 0 )
cvTsFloodWithZeros( test_mat[INPUT][0], ts->get_rng() );
cvTsFloodWithZeros( test_mat[INPUT][0], cv::theRNG() );
return code;
}
@ -1580,7 +1580,7 @@ Core_InvertTest::Core_InvertTest()
void Core_InvertTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int min_size = MIN( sizes[INPUT][0].width, sizes[INPUT][0].height );
@ -1620,7 +1620,7 @@ int Core_InvertTest::prepare_test_case( int test_case_idx )
int code = Core_MatrixTest::prepare_test_case( test_case_idx );
if( code > 0 )
{
cvTsFloodWithZeros( test_mat[INPUT][0], ts->get_rng() );
cvTsFloodWithZeros( test_mat[INPUT][0], cv::theRNG() );
if( method == CV_CHOLESKY )
{
@ -1735,7 +1735,7 @@ Core_SolveTest::Core_SolveTest() : Core_MatrixTest( 2, 1, false, false, 1 ), met
void Core_SolveTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize in_sz = cvSize(sizes[INPUT][0]);
@ -1878,7 +1878,7 @@ flags(0), have_u(false), have_v(false), symmetric(false), compact(false), vector
void Core_SVDTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
Core_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int min_size, i, m, n;
@ -1955,7 +1955,7 @@ int Core_SVDTest::prepare_test_case( int test_case_idx )
if( code > 0 )
{
Mat& input = test_mat[INPUT][0];
cvTsFloodWithZeros( input, ts->get_rng() );
cvTsFloodWithZeros( input, cv::theRNG() );
if( symmetric && (have_u || have_v) )
{
@ -2106,7 +2106,7 @@ flags(0), have_b(false), symmetric(false), compact(false), vector_w(false)
void Core_SVBkSbTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes,
vector<vector<int> >& types )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int min_size, i, m, n;
@ -2170,7 +2170,7 @@ int Core_SVBkSbTest::prepare_test_case( int test_case_idx )
if( code > 0 )
{
Mat& input = test_mat[INPUT][0];
cvTsFloodWithZeros( input, ts->get_rng() );
cvTsFloodWithZeros( input, cv::theRNG() );
if( symmetric )
{
@ -2289,7 +2289,7 @@ Core_SolvePolyTest::~Core_SolvePolyTest() {}
void Core_SolvePolyTest::run( int )
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int fig = 100;
double range = 50;
double err_eps = 1e-4;
@ -2814,7 +2814,7 @@ public:
protected:
void run(int inVariant)
{
RNG& rng = ts->get_rng();
RNG& rng = cv::theRNG();
int i, iter = 0, N = 0, N0 = 0, K = 0, dims = 0;
Mat labels;