Commit 5bafc1db authored by Alexander Alekhin's avatar Alexander Alekhin

test: fix tolerance

cv::rand result is not bitexact for floating-point numbers
parent abad2ca7
...@@ -22,16 +22,19 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge, ...@@ -22,16 +22,19 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
int srcDepth = get<1>(GetParam()); int srcDepth = get<1>(GetParam());
int dstChannels = get<2>(GetParam()); int dstChannels = get<2>(GetParam());
int maxValue = 255;
vector<Mat> mv; vector<Mat> mv;
for( int i = 0; i < dstChannels; ++i ) for( int i = 0; i < dstChannels; ++i )
{ {
mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) ); mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) );
randu(mv[i], 0, 255); randu(mv[i], 0, maxValue);
} }
Mat dst; Mat dst;
int runs = (sz.width <= 640) ? 8 : 1; int runs = (sz.width <= 640) ? 8 : 1;
TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst ); 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);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment