mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
test: fix tolerance
cv::rand result is not bitexact for floating-point numbers
This commit is contained in:
parent
abad2ca76c
commit
5bafc1db75
@ -22,16 +22,19 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
|
||||
int srcDepth = get<1>(GetParam());
|
||||
int dstChannels = get<2>(GetParam());
|
||||
|
||||
int maxValue = 255;
|
||||
|
||||
vector<Mat> mv;
|
||||
for( int i = 0; i < dstChannels; ++i )
|
||||
{
|
||||
mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) );
|
||||
randu(mv[i], 0, 255);
|
||||
randu(mv[i], 0, maxValue);
|
||||
}
|
||||
|
||||
Mat dst;
|
||||
int runs = (sz.width <= 640) ? 8 : 1;
|
||||
TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst );
|
||||
|
||||
SANITY_CHECK(dst, 1e-12);
|
||||
double eps = srcDepth <= CV_32S ? 1e-12 : (FLT_EPSILON * maxValue);
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user