mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 09:25:45 +08:00
Merge pull request #9203 from tomoaki0705:eliminateRandFromTest
This commit is contained in:
commit
ce6b06efb9
@ -29,16 +29,13 @@ CV_UndistortTest::~CV_UndistortTest() {}
|
||||
|
||||
void CV_UndistortTest::generate3DPointCloud(vector<Point3f>& points, Point3f pmin, Point3f pmax)
|
||||
{
|
||||
const Point3f delta = pmax - pmin;
|
||||
RNG rng_Point = ::theRNG(); // fix the seed to use "fixed" input 3D points
|
||||
for (size_t i = 0; i < points.size(); i++)
|
||||
{
|
||||
Point3f p(float(rand()) / RAND_MAX, float(rand()) / RAND_MAX,
|
||||
float(rand()) / RAND_MAX);
|
||||
p.x *= delta.x;
|
||||
p.y *= delta.y;
|
||||
p.z *= delta.z;
|
||||
p = p + pmin;
|
||||
points[i] = p;
|
||||
float _x = rng_Point.uniform(pmin.x, pmax.x);
|
||||
float _y = rng_Point.uniform(pmin.y, pmax.y);
|
||||
float _z = rng_Point.uniform(pmin.z, pmax.z);
|
||||
points[i] = Point3f(_x, _y, _z);
|
||||
}
|
||||
}
|
||||
void CV_UndistortTest::generateCameraMatrix(Mat& cameraMatrix)
|
||||
|
@ -389,11 +389,11 @@ bool Core_EigenTest::check_full(int type)
|
||||
{
|
||||
const int MAX_DEGREE = 7;
|
||||
|
||||
srand((unsigned int)time(0));
|
||||
RNG rng = ::theRNG(); // fix the seed
|
||||
|
||||
for (int i = 0; i < ntests; ++i)
|
||||
{
|
||||
int src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE)+1.));
|
||||
int src_size = (int)(std::pow(2.0, (rng.uniform(0, MAX_DEGREE) + 1.)));
|
||||
|
||||
cv::Mat src(src_size, src_size, type);
|
||||
|
||||
|
@ -110,17 +110,6 @@ PARAM_TEST_CASE(IPPAsyncShared, Channels, hppAccelType)
|
||||
|
||||
sts = hppQueryMatrixAllocParams(accel, (hpp32u)(matrix_Size.width*cn), (hpp32u)matrix_Size.height, HPP_DATA_TYPE_8U, &pitch, &size);
|
||||
|
||||
if (pitch!=0 && size!=0)
|
||||
{
|
||||
uchar *pData = (uchar*)_aligned_malloc(size, 4096);
|
||||
|
||||
for (int j=0; j<matrix_Size.height; j++)
|
||||
for(int i=0; i<matrix_Size.width*cn; i++)
|
||||
pData[i+j*pitch] = rand()%upValue;
|
||||
|
||||
matrix = Mat(matrix_Size.height, matrix_Size.width, type, pData, pitch);
|
||||
}
|
||||
|
||||
matrix = randomMat(matrix_Size, type, 0, upValue);
|
||||
}
|
||||
|
||||
|
@ -612,10 +612,11 @@ TEST_P(Eltwise, Accuracy)
|
||||
eltwiseParam.set("operation", op);
|
||||
if (op == "sum" && weighted)
|
||||
{
|
||||
RNG rng = cv::theRNG();
|
||||
std::vector<float> coeff(1 + numConv);
|
||||
for (int i = 0; i < coeff.size(); ++i)
|
||||
{
|
||||
coeff[i] = ((float)rand() / RAND_MAX) * 4 - 2;
|
||||
coeff[i] = rng.uniform(-2.0f, 2.0f);
|
||||
}
|
||||
eltwiseParam.set("coeff", DictValue::arrayReal<float*>(&coeff[0], coeff.size()));
|
||||
}
|
||||
|
@ -141,9 +141,10 @@ TEST(Photo_AlignMTB, regression)
|
||||
int errors = 0;
|
||||
|
||||
Ptr<AlignMTB> align = createAlignMTB(max_bits);
|
||||
RNG rng = ::theRNG();
|
||||
|
||||
for(int i = 0; i < TESTS_COUNT; i++) {
|
||||
Point shift(rand() % max_shift, rand() % max_shift);
|
||||
Point shift(rng.uniform(0, max_shift), rng.uniform(0, max_shift));
|
||||
Mat res;
|
||||
align->shiftMat(img, res, shift);
|
||||
Point calc = align->calculateShift(img, res);
|
||||
|
Loading…
Reference in New Issue
Block a user