|
|
|
@ -80,12 +80,14 @@ PARAM_TEST_CASE(Lut, int, int, bool, bool) |
|
|
|
|
cv::Mat dst_roi; |
|
|
|
|
|
|
|
|
|
// ocl dst mat for testing
|
|
|
|
|
cv::ocl::oclMat gsrc_whole; |
|
|
|
|
cv::ocl::oclMat glut_whole; |
|
|
|
|
cv::ocl::oclMat gdst_whole; |
|
|
|
|
|
|
|
|
|
// ocl mat with roi
|
|
|
|
|
cv::ocl::oclMat gsrc; |
|
|
|
|
cv::ocl::oclMat glut; |
|
|
|
|
cv::ocl::oclMat gdst; |
|
|
|
|
cv::ocl::oclMat gsrc_roi; |
|
|
|
|
cv::ocl::oclMat glut_roi; |
|
|
|
|
cv::ocl::oclMat gdst_roi; |
|
|
|
|
|
|
|
|
|
virtual void SetUp() |
|
|
|
|
{ |
|
|
|
@ -93,66 +95,34 @@ PARAM_TEST_CASE(Lut, int, int, bool, bool) |
|
|
|
|
cn = GET_PARAM(1); |
|
|
|
|
same_cn = GET_PARAM(2); |
|
|
|
|
use_roi = GET_PARAM(3); |
|
|
|
|
|
|
|
|
|
const int src_type = CV_MAKE_TYPE(CV_8U, cn); |
|
|
|
|
const int lut_type = CV_MAKE_TYPE(lut_depth, same_cn ? cn : 1); |
|
|
|
|
const int dst_type = CV_MAKE_TYPE(lut_depth, cn); |
|
|
|
|
|
|
|
|
|
cv::RNG &rng = TS::ptr()->get_rng(); |
|
|
|
|
|
|
|
|
|
src = randomMat(rng, randomSize(MIN_VALUE, MAX_VALUE), src_type, 0, 256, false); |
|
|
|
|
lut = randomMat(rng, use_roi ? randomSize(260, 300) : Size(256, 1), lut_type, 5, 16, false); |
|
|
|
|
dst = randomMat(rng, use_roi ? randomSize(MIN_VALUE, MAX_VALUE) : src.size(), dst_type, 5, 16, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void random_roi() |
|
|
|
|
{ |
|
|
|
|
// set up roi
|
|
|
|
|
int roicols, roirows; |
|
|
|
|
int srcx, srcy; |
|
|
|
|
int lutx, luty; |
|
|
|
|
int dstx, dsty; |
|
|
|
|
|
|
|
|
|
if (use_roi) |
|
|
|
|
{ |
|
|
|
|
// randomize ROI
|
|
|
|
|
cv::RNG &rng = TS::ptr()->get_rng(); |
|
|
|
|
|
|
|
|
|
roicols = rng.uniform(1, MIN_VALUE); |
|
|
|
|
roirows = rng.uniform(1, MIN_VALUE); |
|
|
|
|
|
|
|
|
|
srcx = rng.uniform(0, src.cols - roicols); |
|
|
|
|
srcy = rng.uniform(0, src.rows - roirows); |
|
|
|
|
lutx = rng.uniform(0, lut.cols - 256); |
|
|
|
|
luty = rng.uniform(0, lut.rows - 1); |
|
|
|
|
const int src_type = CV_MAKE_TYPE(CV_8U, cn); |
|
|
|
|
const int lut_type = CV_MAKE_TYPE(lut_depth, same_cn ? cn : 1); |
|
|
|
|
const int dst_type = CV_MAKE_TYPE(lut_depth, cn); |
|
|
|
|
|
|
|
|
|
dstx = rng.uniform(0, dst.cols - roicols); |
|
|
|
|
dsty = rng.uniform(0, dst.rows - roirows); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
roicols = src.cols; |
|
|
|
|
roirows = src.rows; |
|
|
|
|
srcx = srcy = 0; |
|
|
|
|
lutx = luty = 0; |
|
|
|
|
dstx = dsty = 0; |
|
|
|
|
} |
|
|
|
|
Size roiSize = randomSize(1, MAX_VALUE); |
|
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(src, src_roi, roiSize, srcBorder, src_type, 0, 256); |
|
|
|
|
|
|
|
|
|
src_roi = src(Rect(srcx, srcy, roicols, roirows)); |
|
|
|
|
lut_roi = lut(Rect(lutx, luty, 256, 1)); |
|
|
|
|
dst_roi = dst(Rect(dstx, dsty, roicols, roirows)); |
|
|
|
|
Size lutRoiSize = Size(256, 1); |
|
|
|
|
Border lutBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(lut, lut_roi, lutRoiSize, lutBorder, lut_type, 5, 16); |
|
|
|
|
|
|
|
|
|
gdst_whole = dst; |
|
|
|
|
gdst = gdst_whole(Rect(dstx, dsty, roicols, roirows)); |
|
|
|
|
Border dstBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(dst, dst_roi, roiSize, dstBorder, dst_type, 5, 16); |
|
|
|
|
|
|
|
|
|
gsrc = src_roi; |
|
|
|
|
glut = lut_roi; |
|
|
|
|
generateOclMat(gsrc_whole, gsrc_roi, src, roiSize, srcBorder); |
|
|
|
|
generateOclMat(glut_whole, glut_roi, lut, lutRoiSize, lutBorder); |
|
|
|
|
generateOclMat(gdst_whole, gdst_roi, dst, roiSize, dstBorder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Near(double threshold = 0.) |
|
|
|
|
{ |
|
|
|
|
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst_roi, Mat(gdst), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst_roi, Mat(gdst_roi), threshold); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -163,7 +133,7 @@ TEST_P(Lut, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::LUT(src_roi, lut_roi, dst_roi); |
|
|
|
|
cv::ocl::LUT(gsrc, glut, gdst); |
|
|
|
|
cv::ocl::LUT(gsrc_roi, glut_roi, gdst_roi); |
|
|
|
|
|
|
|
|
|
Near(); |
|
|
|
|
} |
|
|
|
@ -183,50 +153,34 @@ PARAM_TEST_CASE(ArithmTestBase, int, int, bool) |
|
|
|
|
cv::Mat src2; |
|
|
|
|
cv::Mat mask; |
|
|
|
|
cv::Mat dst1; |
|
|
|
|
cv::Mat dst2; // for two outputs
|
|
|
|
|
|
|
|
|
|
// set up roi
|
|
|
|
|
int roicols, roirows; |
|
|
|
|
int src1x, src1y; |
|
|
|
|
int src2x, src2y; |
|
|
|
|
int dst1x, dst1y; |
|
|
|
|
int dst2x, dst2y; |
|
|
|
|
int maskx, masky; |
|
|
|
|
cv::Mat dst2; |
|
|
|
|
|
|
|
|
|
// src mat with roi
|
|
|
|
|
cv::Mat src1_roi; |
|
|
|
|
cv::Mat src2_roi; |
|
|
|
|
cv::Mat mask_roi; |
|
|
|
|
cv::Mat dst1_roi; |
|
|
|
|
cv::Mat dst2_roi; // for two outputs
|
|
|
|
|
cv::Mat dst2_roi; |
|
|
|
|
|
|
|
|
|
// ocl dst mat for testing
|
|
|
|
|
cv::ocl::oclMat gsrc1_whole; |
|
|
|
|
cv::ocl::oclMat gsrc2_whole; |
|
|
|
|
cv::ocl::oclMat gdst1_whole; |
|
|
|
|
cv::ocl::oclMat gdst2_whole; // for two outputs
|
|
|
|
|
cv::ocl::oclMat gdst2_whole; |
|
|
|
|
cv::ocl::oclMat gmask_whole; |
|
|
|
|
|
|
|
|
|
// ocl mat with roi
|
|
|
|
|
cv::ocl::oclMat gsrc1; |
|
|
|
|
cv::ocl::oclMat gsrc2; |
|
|
|
|
cv::ocl::oclMat gdst1; |
|
|
|
|
cv::ocl::oclMat gdst2; // for two outputs
|
|
|
|
|
cv::ocl::oclMat gmask; |
|
|
|
|
cv::ocl::oclMat gsrc1_roi; |
|
|
|
|
cv::ocl::oclMat gsrc2_roi; |
|
|
|
|
cv::ocl::oclMat gdst1_roi; |
|
|
|
|
cv::ocl::oclMat gdst2_roi; |
|
|
|
|
cv::ocl::oclMat gmask_roi; |
|
|
|
|
|
|
|
|
|
virtual void SetUp() |
|
|
|
|
{ |
|
|
|
|
depth = GET_PARAM(0); |
|
|
|
|
cn = GET_PARAM(1); |
|
|
|
|
use_roi = GET_PARAM(2); |
|
|
|
|
const int type = CV_MAKE_TYPE(depth, cn); |
|
|
|
|
|
|
|
|
|
cv::RNG &rng = TS::ptr()->get_rng(); |
|
|
|
|
|
|
|
|
|
src1 = randomMat(rng, randomSize(MIN_VALUE, MAX_VALUE), type, 2, 11, false); |
|
|
|
|
src2 = randomMat(rng, !use_roi ? src1.size() : randomSize(MIN_VALUE, MAX_VALUE), type, -1540, 1740, false); |
|
|
|
|
dst1 = randomMat(rng, !use_roi ? src1.size() : randomSize(MIN_VALUE, MAX_VALUE), type, 5, 16, false); |
|
|
|
|
dst2 = randomMat(rng, !use_roi ? src1.size() : randomSize(MIN_VALUE, MAX_VALUE), type, 5, 16, false); |
|
|
|
|
mask = randomMat(rng, !use_roi ? src1.size() : randomSize(MIN_VALUE, MAX_VALUE), CV_8UC1, 0, 2, false); |
|
|
|
|
|
|
|
|
|
cv::threshold(mask, mask, 0.5, 255., CV_8UC1); |
|
|
|
|
|
|
|
|
|
val = cv::Scalar(rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0), |
|
|
|
|
rng.uniform(-100.0, 100.0), rng.uniform(-100.0, 100.0)); |
|
|
|
@ -234,65 +188,43 @@ PARAM_TEST_CASE(ArithmTestBase, int, int, bool) |
|
|
|
|
|
|
|
|
|
void random_roi() |
|
|
|
|
{ |
|
|
|
|
if (use_roi) |
|
|
|
|
{ |
|
|
|
|
// randomize ROI
|
|
|
|
|
cv::RNG &rng = TS::ptr()->get_rng(); |
|
|
|
|
|
|
|
|
|
roicols = rng.uniform(1, MIN_VALUE); |
|
|
|
|
roirows = rng.uniform(1, MIN_VALUE); |
|
|
|
|
const int type = CV_MAKE_TYPE(depth, cn); |
|
|
|
|
|
|
|
|
|
src1x = rng.uniform(0, src1.cols - roicols); |
|
|
|
|
src1y = rng.uniform(0, src1.rows - roirows); |
|
|
|
|
src2x = rng.uniform(0, src2.cols - roicols); |
|
|
|
|
src2y = rng.uniform(0, src2.rows - roirows); |
|
|
|
|
Size roiSize = randomSize(1, MAX_VALUE); |
|
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 2, 11); |
|
|
|
|
|
|
|
|
|
dst1x = rng.uniform(0, dst1.cols - roicols); |
|
|
|
|
dst1y = rng.uniform(0, dst1.rows - roirows); |
|
|
|
|
dst2x = rng.uniform(0, dst2.cols - roicols); |
|
|
|
|
dst2y = rng.uniform(0, dst2.rows - roirows); |
|
|
|
|
Border src2Border = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(src2, src2_roi, roiSize, src2Border, type, -1540, 1740); |
|
|
|
|
|
|
|
|
|
maskx = rng.uniform(0, mask.cols - roicols); |
|
|
|
|
masky = rng.uniform(0, mask.rows - roirows); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
roicols = src1.cols; |
|
|
|
|
roirows = src1.rows; |
|
|
|
|
src1x = src1y = 0; |
|
|
|
|
src2x = src2y = 0; |
|
|
|
|
dst1x = dst1y = 0; |
|
|
|
|
dst2x = dst2y = 0; |
|
|
|
|
maskx = masky = 0; |
|
|
|
|
} |
|
|
|
|
Border dst1Border = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(dst1, dst1_roi, roiSize, dst1Border, type, 5, 16); |
|
|
|
|
|
|
|
|
|
src1_roi = src1(Rect(src1x, src1y, roicols, roirows)); |
|
|
|
|
src2_roi = src2(Rect(src2x, src2y, roicols, roirows)); |
|
|
|
|
mask_roi = mask(Rect(maskx, masky, roicols, roirows)); |
|
|
|
|
dst1_roi = dst1(Rect(dst1x, dst1y, roicols, roirows)); |
|
|
|
|
dst2_roi = dst2(Rect(dst2x, dst2y, roicols, roirows)); |
|
|
|
|
Border dst2Border = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(dst2, dst2_roi, roiSize, dst2Border, type, 5, 16); |
|
|
|
|
|
|
|
|
|
gdst1_whole = dst1; |
|
|
|
|
gdst1 = gdst1_whole(Rect(dst1x, dst1y, roicols, roirows)); |
|
|
|
|
Border maskBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(mask, mask_roi, roiSize, maskBorder, CV_8UC1, 0, 2); |
|
|
|
|
cv::threshold(mask, mask, 0.5, 255., CV_8UC1); |
|
|
|
|
|
|
|
|
|
gdst2_whole = dst2; |
|
|
|
|
gdst2 = gdst2_whole(Rect(dst2x, dst2y, roicols, roirows)); |
|
|
|
|
|
|
|
|
|
gsrc1 = src1_roi; |
|
|
|
|
gsrc2 = src2_roi; |
|
|
|
|
gmask = mask_roi; |
|
|
|
|
generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder); |
|
|
|
|
generateOclMat(gsrc2_whole, gsrc2_roi, src2, roiSize, src2Border); |
|
|
|
|
generateOclMat(gdst1_whole, gdst1_roi, dst1, roiSize, dst1Border); |
|
|
|
|
generateOclMat(gdst2_whole, gdst2_roi, dst2, roiSize, dst2Border); |
|
|
|
|
generateOclMat(gmask_whole, gmask_roi, mask, roiSize, maskBorder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Near(double threshold = 0.) |
|
|
|
|
{ |
|
|
|
|
EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst1_roi, Mat(gdst1), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst1_roi, Mat(gdst1_roi), threshold); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Near1(double threshold = 0.) |
|
|
|
|
{ |
|
|
|
|
EXPECT_MAT_NEAR(dst2, Mat(gdst2_whole), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst2_roi, Mat(gdst2), threshold); |
|
|
|
|
EXPECT_MAT_NEAR(dst2_roi, Mat(gdst2_roi), threshold); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -307,7 +239,7 @@ TEST_P(Exp, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::exp(src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::exp(gsrc1, gdst1); |
|
|
|
|
cv::ocl::exp(gsrc1_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(2); |
|
|
|
|
} |
|
|
|
@ -324,7 +256,7 @@ TEST_P(Log, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::log(src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::log(gsrc1, gdst1); |
|
|
|
|
cv::ocl::log(gsrc1_roi, gdst1_roi); |
|
|
|
|
Near(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -340,7 +272,7 @@ TEST_P(Add, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::add(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::add(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -352,7 +284,7 @@ TEST_P(Add, Mat_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::add(src1_roi, src2_roi, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::add(gsrc1, gsrc2, gdst1, gmask); |
|
|
|
|
cv::ocl::add(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -364,7 +296,7 @@ TEST_P(Add, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::add(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::add(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::add(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -376,7 +308,7 @@ TEST_P(Add, Scalar_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::add(src1_roi, val, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::add(gsrc1, val, gdst1, gmask); |
|
|
|
|
cv::ocl::add(gsrc1_roi, val, gdst1_roi, gmask_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -392,7 +324,7 @@ TEST_P(Sub, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::subtract(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::subtract(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
@ -405,7 +337,7 @@ TEST_P(Sub, Mat_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::subtract(src1_roi, src2_roi, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::subtract(gsrc1, gsrc2, gdst1, gmask); |
|
|
|
|
cv::ocl::subtract(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -417,7 +349,7 @@ TEST_P(Sub, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::subtract(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::subtract(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::subtract(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
@ -430,7 +362,7 @@ TEST_P(Sub, Scalar_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::subtract(src1_roi, val, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::subtract(gsrc1, val, gdst1, gmask); |
|
|
|
|
cv::ocl::subtract(gsrc1_roi, val, gdst1_roi, gmask_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -446,7 +378,7 @@ TEST_P(Mul, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::multiply(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::multiply(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -458,9 +390,9 @@ TEST_P(Mul, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::multiply(val[0], src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::multiply(val[0], gsrc1, gdst1); |
|
|
|
|
cv::ocl::multiply(val[0], gsrc1_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(gdst1.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -471,9 +403,9 @@ TEST_P(Mul, Mat_Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]); |
|
|
|
|
cv::ocl::multiply(gsrc1, gsrc2, gdst1, val[0]); |
|
|
|
|
cv::ocl::multiply(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]); |
|
|
|
|
|
|
|
|
|
Near(gdst1.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -488,7 +420,7 @@ TEST_P(Div, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::divide(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::divide(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -500,9 +432,9 @@ TEST_P(Div, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::divide(val[0], src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::divide(val[0], gsrc1, gdst1); |
|
|
|
|
cv::ocl::divide(val[0], gsrc1_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(gdst1.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -513,9 +445,9 @@ TEST_P(Div, Mat_Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::divide(src1_roi, src2_roi, dst1_roi, val[0]); |
|
|
|
|
cv::ocl::divide(gsrc1, gsrc2, gdst1, val[0]); |
|
|
|
|
cv::ocl::divide(gsrc1_roi, gsrc2_roi, gdst1_roi, val[0]); |
|
|
|
|
|
|
|
|
|
Near(gdst1.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
Near(gdst1_roi.depth() >= CV_32F ? 1e-3 : 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -530,7 +462,7 @@ TEST_P(Absdiff, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::absdiff(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::absdiff(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::absdiff(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -542,7 +474,7 @@ TEST_P(Absdiff, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::absdiff(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::absdiff(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::absdiff(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -558,7 +490,7 @@ TEST_P(CartToPolar, angleInDegree) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi, true); |
|
|
|
|
cv::ocl::cartToPolar(gsrc1, gsrc2, gdst1, gdst2, true); |
|
|
|
|
cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true); |
|
|
|
|
Near(.5); |
|
|
|
|
Near1(.5); |
|
|
|
|
} |
|
|
|
@ -571,7 +503,7 @@ TEST_P(CartToPolar, angleInRadians) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::cartToPolar(src1_roi, src2_roi, dst1_roi, dst2_roi); |
|
|
|
|
cv::ocl::cartToPolar(gsrc1, gsrc2, gdst1, gdst2); |
|
|
|
|
cv::ocl::cartToPolar(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi); |
|
|
|
|
Near(.5); |
|
|
|
|
Near1(.5); |
|
|
|
|
} |
|
|
|
@ -588,7 +520,7 @@ TEST_P(PolarToCart, angleInDegree) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi, true); |
|
|
|
|
cv::ocl::polarToCart(gsrc1, gsrc2, gdst1, gdst2, true); |
|
|
|
|
cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi, true); |
|
|
|
|
|
|
|
|
|
Near(.5); |
|
|
|
|
Near1(.5); |
|
|
|
@ -602,7 +534,7 @@ TEST_P(PolarToCart, angleInRadians) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::polarToCart(src1_roi, src2_roi, dst1_roi, dst2_roi); |
|
|
|
|
cv::ocl::polarToCart(gsrc1, gsrc2, gdst1, gdst2); |
|
|
|
|
cv::ocl::polarToCart(gsrc1_roi, gsrc2_roi, gdst1_roi, gdst2_roi); |
|
|
|
|
|
|
|
|
|
Near(.5); |
|
|
|
|
Near1(.5); |
|
|
|
@ -620,7 +552,7 @@ TEST_P(Magnitude, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::magnitude(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::magnitude(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::magnitude(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(depth == CV_64F ? 1e-5 : 1e-2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -636,7 +568,7 @@ TEST_P(Transpose, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::transpose(src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::transpose(gsrc1, gdst1); |
|
|
|
|
cv::ocl::transpose(gsrc1_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
@ -644,35 +576,23 @@ TEST_P(Transpose, Mat) |
|
|
|
|
|
|
|
|
|
TEST_P(Transpose, SquareInplace) |
|
|
|
|
{ |
|
|
|
|
cv::RNG &rng = TS::ptr()->get_rng(); |
|
|
|
|
int value = randomInt(MIN_VALUE, MAX_VALUE); |
|
|
|
|
src1 = randomMat(rng, Size(value, value), CV_MAKE_TYPE(depth, cn), 5, 16, false); |
|
|
|
|
const int type = CV_MAKE_TYPE(depth, cn); |
|
|
|
|
|
|
|
|
|
if (use_roi) |
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++) |
|
|
|
|
{ |
|
|
|
|
roirows = roicols = randomInt(1, src1.cols); |
|
|
|
|
Size roiSize = randomSize(1, MAX_VALUE); |
|
|
|
|
roiSize.height = roiSize.width; // make it square
|
|
|
|
|
|
|
|
|
|
src1x = randomInt(0, src1.cols - roicols); |
|
|
|
|
src1y = randomInt(0, src1.rows - roirows); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
roicols = roirows = src1.cols; |
|
|
|
|
src1x = src1y = 0; |
|
|
|
|
} |
|
|
|
|
Border srcBorder = randomBorder(0, use_roi ? MAX_VALUE : 0); |
|
|
|
|
randomSubMat(src1, src1_roi, roiSize, srcBorder, type, 5, 16); |
|
|
|
|
|
|
|
|
|
Rect r(src1x, src1y, roicols, roirows); |
|
|
|
|
src1_roi = src1(r); |
|
|
|
|
gdst1_whole = src1; |
|
|
|
|
gdst1 = gdst1_whole(r); |
|
|
|
|
generateOclMat(gsrc1_whole, gsrc1_roi, src1, roiSize, srcBorder); |
|
|
|
|
|
|
|
|
|
for (int j = 0; j < LOOP_TIMES; j++) |
|
|
|
|
{ |
|
|
|
|
cv::transpose(src1_roi, src1_roi); |
|
|
|
|
cv::ocl::transpose(gdst1, gdst1); |
|
|
|
|
cv::ocl::transpose(gsrc1_roi, gsrc1_roi); |
|
|
|
|
|
|
|
|
|
EXPECT_MAT_NEAR(src1, Mat(gdst1_whole), 0.0); |
|
|
|
|
EXPECT_MAT_NEAR(src1_roi, Mat(gdst1), 0.0); |
|
|
|
|
EXPECT_MAT_NEAR(src1, Mat(gsrc1_whole), 0.0); |
|
|
|
|
EXPECT_MAT_NEAR(src1_roi, Mat(gsrc1_roi), 0.0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -687,7 +607,7 @@ TEST_P(Flip, X) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::flip(src1_roi, dst1_roi, 0); |
|
|
|
|
cv::ocl::flip(gsrc1, gdst1, 0); |
|
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, 0); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -699,7 +619,7 @@ TEST_P(Flip, Y) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::flip(src1_roi, dst1_roi, 1); |
|
|
|
|
cv::ocl::flip(gsrc1, gdst1, 1); |
|
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, 1); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -711,7 +631,7 @@ TEST_P(Flip, BOTH) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::flip(src1_roi, dst1_roi, -1); |
|
|
|
|
cv::ocl::flip(gsrc1, gdst1, -1); |
|
|
|
|
cv::ocl::flip(gsrc1_roi, gdst1_roi, -1); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -739,12 +659,12 @@ TEST_P(MinMax, MAT) |
|
|
|
|
{ |
|
|
|
|
signed char val = src1_roi.at<signed char>(i, j); |
|
|
|
|
if (val < minVal) minVal = val; |
|
|
|
|
else if (val > maxVal) maxVal = val; |
|
|
|
|
if (val > maxVal) maxVal = val; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double minVal_, maxVal_; |
|
|
|
|
cv::ocl::minMax(gsrc1, &minVal_, &maxVal_); |
|
|
|
|
cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_); |
|
|
|
|
|
|
|
|
|
EXPECT_DOUBLE_EQ(minVal_, minVal); |
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal_, maxVal); |
|
|
|
@ -777,7 +697,7 @@ TEST_P(MinMax, MASK) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double minVal_, maxVal_; |
|
|
|
|
cv::ocl::minMax(gsrc1, &minVal_, &maxVal_, gmask); |
|
|
|
|
cv::ocl::minMax(gsrc1_roi, &minVal_, &maxVal_, gmask_roi); |
|
|
|
|
|
|
|
|
|
EXPECT_DOUBLE_EQ(minVal, minVal_); |
|
|
|
|
EXPECT_DOUBLE_EQ(maxVal, maxVal_); |
|
|
|
@ -825,7 +745,7 @@ TEST_P(MinMaxLoc, MAT) |
|
|
|
|
|
|
|
|
|
double minVal_, maxVal_; |
|
|
|
|
cv::Point minLoc_, maxLoc_; |
|
|
|
|
cv::ocl::minMaxLoc(gsrc1, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat()); |
|
|
|
|
cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat()); |
|
|
|
|
|
|
|
|
|
double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.; |
|
|
|
|
if (depth == 0) |
|
|
|
@ -938,7 +858,7 @@ TEST_P(MinMaxLoc, MASK) |
|
|
|
|
|
|
|
|
|
double minVal_, maxVal_; |
|
|
|
|
cv::Point minLoc_, maxLoc_; |
|
|
|
|
cv::ocl::minMaxLoc(gsrc1, &minVal_, &maxVal_, &minLoc_, &maxLoc_, gmask); |
|
|
|
|
cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, gmask_roi); |
|
|
|
|
|
|
|
|
|
double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.; |
|
|
|
|
if (minLoc_.x == -1 || minLoc_.y == -1 || maxLoc_.x == -1 || maxLoc_.y == -1) continue; |
|
|
|
@ -1027,7 +947,7 @@ TEST_P(Sum, MAT) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
Scalar cpures = cv::sum(src1_roi); |
|
|
|
|
Scalar gpures = cv::ocl::sum(gsrc1); |
|
|
|
|
Scalar gpures = cv::ocl::sum(gsrc1_roi); |
|
|
|
|
|
|
|
|
|
// check results
|
|
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 0.1); |
|
|
|
@ -1085,7 +1005,7 @@ TEST_P(SqrSum, MAT) |
|
|
|
|
CV_Assert(func != 0); |
|
|
|
|
|
|
|
|
|
Scalar cpures = func(src1_roi); |
|
|
|
|
Scalar gpures = cv::ocl::sqrSum(gsrc1); |
|
|
|
|
Scalar gpures = cv::ocl::sqrSum(gsrc1_roi); |
|
|
|
|
|
|
|
|
|
// check results
|
|
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 1.0); |
|
|
|
@ -1141,7 +1061,7 @@ TEST_P(AbsSum, MAT) |
|
|
|
|
CV_Assert(func != 0); |
|
|
|
|
|
|
|
|
|
Scalar cpures = func(src1_roi); |
|
|
|
|
Scalar gpures = cv::ocl::absSum(gsrc1); |
|
|
|
|
Scalar gpures = cv::ocl::absSum(gsrc1_roi); |
|
|
|
|
|
|
|
|
|
// check results
|
|
|
|
|
EXPECT_NEAR(cpures[0], gpures[0], 0.1); |
|
|
|
@ -1161,7 +1081,7 @@ TEST_P(CountNonZero, MAT) |
|
|
|
|
{ |
|
|
|
|
random_roi(); |
|
|
|
|
int cpures = cv::countNonZero(src1_roi); |
|
|
|
|
int gpures = cv::ocl::countNonZero(gsrc1); |
|
|
|
|
int gpures = cv::ocl::countNonZero(gsrc1_roi); |
|
|
|
|
|
|
|
|
|
EXPECT_DOUBLE_EQ((double)cpures, (double)gpures); |
|
|
|
|
} |
|
|
|
@ -1177,7 +1097,7 @@ TEST_P(Phase, angleInDegrees) |
|
|
|
|
{ |
|
|
|
|
random_roi(); |
|
|
|
|
cv::phase(src1_roi, src2_roi, dst1_roi, true); |
|
|
|
|
cv::ocl::phase(gsrc1, gsrc2, gdst1, true); |
|
|
|
|
cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi, true); |
|
|
|
|
|
|
|
|
|
Near(1e-2); |
|
|
|
|
} |
|
|
|
@ -1189,7 +1109,7 @@ TEST_P(Phase, angleInRadians) |
|
|
|
|
{ |
|
|
|
|
random_roi(); |
|
|
|
|
cv::phase(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::phase(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::phase(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(1e-2); |
|
|
|
|
} |
|
|
|
@ -1206,7 +1126,7 @@ TEST_P(Bitwise_and, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_and(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1218,7 +1138,7 @@ TEST_P(Bitwise_and, Mat_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_and(src1_roi, src2_roi, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1, gsrc2, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1230,7 +1150,7 @@ TEST_P(Bitwise_and, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_and(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1242,7 +1162,7 @@ TEST_P(Bitwise_and, Scalar_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_and(src1_roi, val, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1, val, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_and(gsrc1_roi, val, gdst1_roi, gmask_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1258,7 +1178,7 @@ TEST_P(Bitwise_or, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_or(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1270,7 +1190,7 @@ TEST_P(Bitwise_or, Mat_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_or(src1_roi, src2_roi, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1, gsrc2, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1282,7 +1202,7 @@ TEST_P(Bitwise_or, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_or(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1294,7 +1214,7 @@ TEST_P(Bitwise_or, Scalar_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_or(src1_roi, val, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1, val, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_or(gsrc1_roi, val, gdst1_roi, gmask_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1310,7 +1230,7 @@ TEST_P(Bitwise_xor, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_xor(src1_roi, src2_roi, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1, gsrc2, gdst1); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1322,7 +1242,7 @@ TEST_P(Bitwise_xor, Mat_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_xor(src1_roi, src2_roi, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1, gsrc2, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, gsrc2_roi, gdst1_roi, gmask_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1334,7 +1254,7 @@ TEST_P(Bitwise_xor, Scalar) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_xor(src1_roi, val, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1, val, gdst1); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1346,7 +1266,7 @@ TEST_P(Bitwise_xor, Scalar_Mask) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_xor(src1_roi, val, dst1_roi, mask_roi); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1, val, gdst1, gmask); |
|
|
|
|
cv::ocl::bitwise_xor(gsrc1_roi, val, gdst1_roi, gmask_roi); |
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1362,7 +1282,7 @@ TEST_P(Bitwise_not, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::bitwise_not(src1_roi, dst1_roi); |
|
|
|
|
cv::ocl::bitwise_not(gsrc1, gdst1); |
|
|
|
|
cv::ocl::bitwise_not(gsrc1_roi, gdst1_roi); |
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1382,7 +1302,7 @@ TEST_P(Compare, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::compare(src1_roi, src2_roi, dst1_roi, cmp_codes[i]); |
|
|
|
|
cv::ocl::compare(gsrc1, gsrc2, gdst1, cmp_codes[i]); |
|
|
|
|
cv::ocl::compare(gsrc1_roi, gsrc2_roi, gdst1_roi, cmp_codes[i]); |
|
|
|
|
|
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
@ -1399,7 +1319,7 @@ TEST_P(Pow, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
double p = 4.5; |
|
|
|
|
cv::pow(src1_roi, p, dst1_roi); |
|
|
|
|
cv::ocl::pow(gsrc1, p, gdst1); |
|
|
|
|
cv::ocl::pow(gsrc1_roi, p, gdst1_roi); |
|
|
|
|
Near(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1417,7 +1337,7 @@ TEST_P(AddWeighted, Mat) |
|
|
|
|
const double alpha = 2.0, beta = 1.0, gama = 3.0; |
|
|
|
|
|
|
|
|
|
cv::addWeighted(src1_roi, alpha, src2_roi, beta, gama, dst1_roi); |
|
|
|
|
cv::ocl::addWeighted(gsrc1, alpha, gsrc2, beta, gama, gdst1); |
|
|
|
|
cv::ocl::addWeighted(gsrc1_roi, alpha, gsrc2_roi, beta, gama, gdst1_roi); |
|
|
|
|
|
|
|
|
|
Near(1e-5); |
|
|
|
|
} |
|
|
|
@ -1434,7 +1354,7 @@ TEST_P(SetIdentity, Mat) |
|
|
|
|
random_roi(); |
|
|
|
|
|
|
|
|
|
cv::setIdentity(dst1_roi, val); |
|
|
|
|
cv::ocl::setIdentity(gdst1, val); |
|
|
|
|
cv::ocl::setIdentity(gdst1_roi, val); |
|
|
|
|
|
|
|
|
|
Near(0); |
|
|
|
|
} |
|
|
|
@ -1454,7 +1374,7 @@ TEST_P(MeanStdDev, Mat) |
|
|
|
|
Scalar gpu_mean, gpu_stddev; |
|
|
|
|
|
|
|
|
|
cv::meanStdDev(src1_roi, cpu_mean, cpu_stddev); |
|
|
|
|
cv::ocl::meanStdDev(gsrc1, gpu_mean, gpu_stddev); |
|
|
|
|
cv::ocl::meanStdDev(gsrc1_roi, gpu_mean, gpu_stddev); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; ++i) |
|
|
|
|
{ |
|
|
|
@ -1480,7 +1400,7 @@ TEST_P(Norm, NORM_INF) |
|
|
|
|
type |= NORM_RELATIVE; |
|
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1, gsrc2, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type); |
|
|
|
|
|
|
|
|
|
EXPECT_NEAR(cpuRes, gpuRes, 0.1); |
|
|
|
|
} |
|
|
|
@ -1498,7 +1418,7 @@ TEST_P(Norm, NORM_L1) |
|
|
|
|
type |= NORM_RELATIVE; |
|
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1, gsrc2, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type); |
|
|
|
|
|
|
|
|
|
EXPECT_NEAR(cpuRes, gpuRes, 0.1); |
|
|
|
|
} |
|
|
|
@ -1516,7 +1436,7 @@ TEST_P(Norm, NORM_L2) |
|
|
|
|
type |= NORM_RELATIVE; |
|
|
|
|
|
|
|
|
|
const double cpuRes = cv::norm(src1_roi, src2_roi, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1, gsrc2, type); |
|
|
|
|
const double gpuRes = cv::ocl::norm(gsrc1_roi, gsrc2_roi, type); |
|
|
|
|
|
|
|
|
|
EXPECT_NEAR(cpuRes, gpuRes, 0.1); |
|
|
|
|
} |
|
|
|
|