mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
fix warnings, unify test names
This commit is contained in:
parent
b6313951dc
commit
ada8f92cc7
@ -174,16 +174,12 @@ PARAM_TEST_CASE(ArithmTestBase, MatType, bool)
|
||||
|
||||
void Near(double threshold = 0.)
|
||||
{
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, threshold);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), threshold);
|
||||
}
|
||||
|
||||
void Near1(double threshold = 0.)
|
||||
{
|
||||
cv::Mat cpu_dst1;
|
||||
gdst1_whole.download(cpu_dst1);
|
||||
EXPECT_MAT_NEAR(dst1, cpu_dst1, threshold);
|
||||
{
|
||||
EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), threshold);
|
||||
}
|
||||
|
||||
};
|
||||
@ -1169,33 +1165,18 @@ TEST_P(MagnitudeSqr, Mat)
|
||||
{
|
||||
for(int j = 0; j < LOOP_TIMES; j++)
|
||||
{
|
||||
// random_roi();
|
||||
// int64 start, end;
|
||||
// start = cv::getTickCount();
|
||||
random_roi();
|
||||
for(int i = 0; i < mat1.rows; ++i)
|
||||
for(int j = 0; j < mat1.cols; ++j)
|
||||
{
|
||||
float val1 = mat1.at<float>(i, j);
|
||||
float val2 = mat2.at<float>(i, j);
|
||||
|
||||
((float *)(dst.data))[i * dst.step / 4 + j] = val1 * val1 + val2 * val2;
|
||||
|
||||
// float val1 =((float *)( mat1.data))[(i*mat1.step/8 +j)*2];
|
||||
//
|
||||
// float val2 =((float *)( mat1.data))[(i*mat1.step/8 +j)*2+ 1 ];
|
||||
|
||||
// ((float *)(dst.data))[i*dst.step/4 +j]= val1 * val1 +val2 * val2;
|
||||
}
|
||||
// end = cv::getTickCount();
|
||||
|
||||
|
||||
cv::ocl::oclMat clmat1(mat1), clmat2(mat2), cldst;
|
||||
cv::ocl::magnitudeSqr(clmat1, clmat2, cldst);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
cldst.download(cpu_dst);
|
||||
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, 1);
|
||||
cv::ocl::oclMat clmat1(mat1), clmat2(mat2);
|
||||
cv::ocl::magnitudeSqr(clmat1, clmat2, gdst);
|
||||
Near(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ TEST_P(Blend, Accuracy)
|
||||
EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine(
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, Blend, Combine(
|
||||
DIFFERENT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4))
|
||||
));
|
||||
|
@ -88,7 +88,7 @@ TEST_P(ColumnSum, Accuracy)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ColumnSum, DIFFERENT_SIZES);
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, ColumnSum, DIFFERENT_SIZES);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -125,9 +125,7 @@ PARAM_TEST_CASE(FilterTestBase,
|
||||
|
||||
void Near(double threshold)
|
||||
{
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, threshold);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), threshold);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -244,7 +244,7 @@ TEST_P(HOG, Detect)
|
||||
}
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HOG, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ObjDetect, HOG, testing::Combine(
|
||||
testing::Values(cv::Size(64, 128), cv::Size(48, 96)),
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
|
||||
|
||||
|
@ -89,12 +89,10 @@ TEST_P(MatchTemplate8U, Accuracy)
|
||||
cv::Mat dst_gold;
|
||||
cv::matchTemplate(image, templ, dst_gold, method);
|
||||
|
||||
char sss [100] = "";
|
||||
|
||||
cv::Mat mat_dst;
|
||||
dst.download(mat_dst);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
|
||||
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1);
|
||||
}
|
||||
|
||||
PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMethod)
|
||||
@ -125,12 +123,10 @@ TEST_P(MatchTemplate32F, Accuracy)
|
||||
cv::Mat dst_gold;
|
||||
cv::matchTemplate(image, templ, dst_gold, method);
|
||||
|
||||
char sss [100] = "";
|
||||
|
||||
cv::Mat mat_dst;
|
||||
dst.download(mat_dst);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
|
||||
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MatchTemplate8U,
|
||||
|
@ -135,12 +135,7 @@ TEST_P(ConvertTo, Accuracy)
|
||||
mat_roi.convertTo(dst_roi, dst_type);
|
||||
gmat.convertTo(gdst, dst_type);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d", roicols, roirows, srcx , srcy, dstx, dsty);
|
||||
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,12 +237,7 @@ TEST_P(CopyTo, Without_mask)
|
||||
mat_roi.copyTo(dst_roi);
|
||||
gmat.copyTo(gdst);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, dstx, dsty, maskx, masky);
|
||||
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,12 +250,7 @@ TEST_P(CopyTo, With_mask)
|
||||
mat_roi.copyTo(dst_roi, mask_roi);
|
||||
gmat.copyTo(gdst, gmask);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,dstx=%d,dsty=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, dstx, dsty, maskx, masky);
|
||||
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,12 +342,7 @@ TEST_P(SetTo, Without_mask)
|
||||
mat_roi.setTo(val);
|
||||
gmat.setTo(val);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gmat_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, maskx, masky);
|
||||
|
||||
EXPECT_MAT_NEAR(mat, cpu_dst, 1., sss);
|
||||
EXPECT_MAT_NEAR(mat, Mat(gmat_whole), 1.);
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,12 +355,7 @@ TEST_P(SetTo, With_mask)
|
||||
mat_roi.setTo(val, mask_roi);
|
||||
gmat.setTo(val, gmask);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gmat_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,srcx =%d,srcy=%d,maskx=%d,masky=%d", roicols, roirows, srcx , srcy, maskx, masky);
|
||||
|
||||
EXPECT_MAT_NEAR(mat, cpu_dst, 1., sss);
|
||||
EXPECT_MAT_NEAR(mat, Mat(gmat_whole), 1.);
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,11 +439,8 @@ TEST_P(convertC3C4, Accuracy)
|
||||
|
||||
mat1 = randomMat(rng, size, type, 0, 40, false);
|
||||
gmat1 = mat1;
|
||||
cv::Mat cpu_dst;
|
||||
gmat1.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "cols=%d,rows=%d", mat1.cols, mat1.rows);
|
||||
EXPECT_MAT_NEAR(mat1, cpu_dst, 0.0, sss);
|
||||
|
||||
EXPECT_MAT_NEAR(mat1, Mat(gmat1), 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using namespace cvtest;
|
||||
using namespace testing;
|
||||
using namespace std;
|
||||
extern string workdir;
|
||||
PARAM_TEST_CASE(MomentsTestBase, MatType, bool)
|
||||
PARAM_TEST_CASE(MomentsTest, MatType, bool)
|
||||
{
|
||||
int type;
|
||||
cv::Mat mat1;
|
||||
@ -30,13 +30,13 @@ PARAM_TEST_CASE(MomentsTestBase, MatType, bool)
|
||||
Mat gpu_dst, cpu_dst;
|
||||
HuMoments(cpu, cpu_dst);
|
||||
HuMoments(gpu, gpu_dst);
|
||||
EXPECT_MAT_NEAR(gpu_dst,cpu_dst, .5, "");
|
||||
EXPECT_MAT_NEAR(gpu_dst,cpu_dst, .5);
|
||||
}
|
||||
|
||||
};
|
||||
struct ocl_Moments : MomentsTestBase {};
|
||||
|
||||
TEST_P(ocl_Moments, Mat)
|
||||
|
||||
TEST_P(MomentsTest, Mat)
|
||||
{
|
||||
bool binaryImage = 0;
|
||||
SetUp();
|
||||
@ -67,6 +67,6 @@ TEST_P(ocl_Moments, Mat)
|
||||
|
||||
}
|
||||
}
|
||||
INSTANTIATE_TEST_CASE_P(Moments, ocl_Moments, Combine(
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MomentsTest, Combine(
|
||||
Values(CV_8UC1, CV_16UC1, CV_16SC1, CV_64FC1), Values(true,false)));
|
||||
#endif // HAVE_OPENCL
|
||||
|
@ -83,15 +83,11 @@ TEST_P(PyrDown, Mat)
|
||||
cv::pyrDown(src, dst_cpu);
|
||||
cv::ocl::pyrDown(gsrc, gdst);
|
||||
|
||||
cv::Mat dst;
|
||||
gdst.download(dst);
|
||||
char s[1024] = {0};
|
||||
|
||||
EXPECT_MAT_NEAR(dst, dst_cpu, dst.depth() == CV_32F ? 1e-4f : 1.0f, s);
|
||||
EXPECT_MAT_NEAR(dst_cpu, Mat(gdst), type == CV_32F ? 1e-4f : 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, PyrDown, Combine(
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, PyrDown, Combine(
|
||||
Values(CV_8U, CV_32F), Values(1, 3, 4)));
|
||||
|
||||
|
||||
|
@ -77,17 +77,14 @@ TEST_P(PyrUp, Accuracy)
|
||||
ocl::oclMat dst;
|
||||
ocl::oclMat srcMat(src);
|
||||
ocl::pyrUp(srcMat, dst);
|
||||
Mat cpu_dst;
|
||||
dst.download(cpu_dst);
|
||||
char s[100] = {0};
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, cpu_dst, (src.depth() == CV_32F ? 1e-4f : 1.0), s);
|
||||
EXPECT_MAT_NEAR(dst_gold, Mat(dst), (type == CV_32F ? 1e-4f : 1.0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, PyrUp, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, PyrUp, testing::Combine(
|
||||
Values(CV_8U, CV_32F), Values(1, 3, 4)));
|
||||
|
||||
|
||||
|
@ -202,12 +202,7 @@ TEST_P(Merge, Accuracy)
|
||||
cv::merge(dev_src, dst_roi);
|
||||
cv::ocl::merge(dev_gsrc, gdst);
|
||||
|
||||
cv::Mat cpu_dst;
|
||||
gdst_whole.download(cpu_dst);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,src1x =%d,src1y=%d,src2x =%d,src2y=%d,src3x =%d,src3y=%d,src4x =%d,src4y=%d,dstx=%d,dsty=%d", roicols, roirows, src1x, src1y, src2x , src2y, src3x , src3y, src4x , src4y, dstx, dsty);
|
||||
|
||||
EXPECT_MAT_NEAR(dst, cpu_dst, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst, Mat(gdst_whole), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,28 +344,17 @@ TEST_P(Split, Accuracy)
|
||||
cv::split(mat_roi, dev_dst);
|
||||
cv::ocl::split(gmat, dev_gdst);
|
||||
|
||||
cv::Mat cpu_dst1;
|
||||
cv::Mat cpu_dst2;
|
||||
cv::Mat cpu_dst3;
|
||||
cv::Mat cpu_dst4;
|
||||
gdst1_whole.download(cpu_dst1);
|
||||
gdst2_whole.download(cpu_dst2);
|
||||
gdst3_whole.download(cpu_dst3);
|
||||
gdst4_whole.download(cpu_dst4);
|
||||
char sss[1024];
|
||||
sprintf(sss, "roicols=%d,roirows=%d,dst1x =%d,dsty=%d,dst2x =%d,dst2y=%d,dst3x =%d,dst3y=%d,dst4x =%d,dst4y=%d,srcx=%d,srcy=%d", roicols, roirows, dst1x , dst1y, dst2x , dst2y, dst3x , dst3y, dst4x , dst4y, srcx, srcy);
|
||||
|
||||
if(channels >= 1)
|
||||
EXPECT_MAT_NEAR(dst1, cpu_dst1, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), 0.0);
|
||||
|
||||
if(channels >= 2)
|
||||
EXPECT_MAT_NEAR(dst2, cpu_dst2, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst2, Mat(gdst2_whole), 0.0);
|
||||
|
||||
if(channels >= 3)
|
||||
EXPECT_MAT_NEAR(dst3, cpu_dst3, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst3, Mat(gdst3_whole), 0.0);
|
||||
|
||||
if(channels >= 4)
|
||||
EXPECT_MAT_NEAR(dst4, cpu_dst4, 0.0, sss);
|
||||
EXPECT_MAT_NEAR(dst4, Mat(gdst4_whole), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user