added gpu 1d window sum, convertTo, based on NPP.
added RGB <-> XYZ color conversion. gpu morphology minor fix.
This commit is contained in:
@@ -47,12 +47,11 @@ const char* blacklist[] =
|
||||
{
|
||||
"GPU-NppImageSum", // crash
|
||||
"GPU-MatOperatorAsyncCall", // crash
|
||||
//"GPU-NppErode", // npp func returns error code (CUDA_KERNEL_LAUNCH_ERROR or TEXTURE_BIND_ERROR)
|
||||
//"GPU-NppDilate", // npp func returns error code (CUDA_KERNEL_LAUNCH_ERROR or TEXTURE_BIND_ERROR)
|
||||
//"GPU-NppMorphologyEx", // npp func returns error code (CUDA_KERNEL_LAUNCH_ERROR or TEXTURE_BIND_ERROR)
|
||||
//"GPU-NppErode", // different border interpolation
|
||||
//"GPU-NppMorphologyEx", // different border interpolation
|
||||
//"GPU-NppImageDivide", // different round mode
|
||||
//"GPU-NppImageMeanStdDev", // different precision
|
||||
//"GPU-NppImageMinNax", // npp bug
|
||||
//"GPU-NppImageMinNax", // npp bug - don't find min/max near right border
|
||||
//"GPU-NppImageResize", // different precision in interpolation
|
||||
//"GPU-NppImageWarpAffine", // different precision in interpolation
|
||||
//"GPU-NppImageWarpPerspective", // different precision in interpolation
|
||||
@@ -61,6 +60,7 @@ const char* blacklist[] =
|
||||
//"GPU-NppImageExp", // different precision
|
||||
//"GPU-NppImageLog", // different precision
|
||||
//"GPU-NppImageMagnitude", // different precision
|
||||
//"GPU-NppImageSumWindow", // different border interpolation
|
||||
0
|
||||
};
|
||||
|
||||
|
@@ -451,6 +451,47 @@ struct CV_GpuNppImageBlurTest : public CV_GpuImageProcTest
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// sumWindow
|
||||
struct CV_GpuNppImageSumWindowTest : public CV_GpuImageProcTest
|
||||
{
|
||||
CV_GpuNppImageSumWindowTest() : CV_GpuImageProcTest( "GPU-NppImageSumWindow", "sumWindow" ) {}
|
||||
|
||||
int test(const Mat& img)
|
||||
{
|
||||
if (img.type() != CV_8UC1)
|
||||
{
|
||||
ts->printf(CvTS::LOG, "\nUnsupported type\n");
|
||||
return CvTS::OK;
|
||||
}
|
||||
|
||||
int ksizes[] = {3, 5, 7};
|
||||
int ksizes_num = sizeof(ksizes) / sizeof(int);
|
||||
|
||||
int test_res = CvTS::OK;
|
||||
|
||||
for (int i = 0; i < ksizes_num; ++i)
|
||||
{
|
||||
ts->printf(CvTS::LOG, "\nksize = %d\n", ksizes[i]);
|
||||
|
||||
Mat cpudst(img.size(), CV_64FC1, Scalar());
|
||||
cv::Ptr<cv::BaseRowFilter> ft = cv::getRowSumFilter(CV_8UC1, CV_64FC1, ksizes[i], 0);
|
||||
for (int y = 0; y < img.rows; ++y)
|
||||
(*ft)(img.ptr(y), cpudst.ptr(y), img.cols, 1);
|
||||
cpudst.convertTo(cpudst, CV_32F);
|
||||
|
||||
GpuMat gpu1(img);
|
||||
GpuMat gpudst;
|
||||
cv::gpu::sumWindowRow(gpu1, gpudst, ksizes[i], 0);
|
||||
|
||||
if (CheckNorm(cpudst, gpudst) != CvTS::OK)
|
||||
test_res = CvTS::FAIL_GENERIC;
|
||||
}
|
||||
|
||||
return test_res;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cvtColor
|
||||
class CV_GpuCvtColorTest : public CvTest
|
||||
@@ -501,11 +542,13 @@ void CV_GpuCvtColorTest::run( int )
|
||||
int codes[] = { CV_BGR2RGB, CV_RGB2BGRA, CV_BGRA2RGB,
|
||||
CV_RGB2BGR555, CV_BGR5552BGR, CV_BGR2BGR565, CV_BGR5652RGB,
|
||||
CV_RGB2YCrCb, CV_YCrCb2BGR, CV_BGR2YUV, CV_YUV2RGB,
|
||||
CV_RGB2XYZ, CV_XYZ2BGR, CV_BGR2XYZ, CV_XYZ2RGB,
|
||||
CV_RGB2GRAY, CV_GRAY2BGRA, CV_BGRA2GRAY,
|
||||
CV_GRAY2BGR555, CV_BGR5552GRAY, CV_GRAY2BGR565, CV_BGR5652GRAY};
|
||||
const char* codes_str[] = { "CV_BGR2RGB", "CV_RGB2BGRA", "CV_BGRA2RGB",
|
||||
"CV_RGB2BGR555", "CV_BGR5552BGR", "CV_BGR2BGR565", "CV_BGR5652RGB",
|
||||
"CV_RGB2YCrCb", "CV_YCrCb2BGR", "CV_BGR2YUV", "CV_YUV2RGB",
|
||||
"CV_RGB2XYZ", "CV_XYZ2BGR", "CV_BGR2XYZ", "CV_XYZ2RGB",
|
||||
"CV_RGB2GRAY", "CV_GRAY2BGRA", "CV_BGRA2GRAY",
|
||||
"CV_GRAY2BGR555", "CV_BGR5552GRAY", "CV_GRAY2BGR565", "CV_BGR5652GRAY"};
|
||||
int codes_num = sizeof(codes) / sizeof(int);
|
||||
@@ -554,4 +597,5 @@ CV_GpuNppImageWarpAffineTest CV_GpuNppImageWarpAffine_test;
|
||||
CV_GpuNppImageWarpPerspectiveTest CV_GpuNppImageWarpPerspective_test;
|
||||
CV_GpuNppImageIntegralTest CV_GpuNppImageIntegral_test;
|
||||
CV_GpuNppImageBlurTest CV_GpuNppImageBlur_test;
|
||||
CV_GpuCvtColorTest CV_GpuCvtColor_test;
|
||||
CV_GpuNppImageSumWindowTest CV_GpuNppImageSumWindow_test;
|
||||
CV_GpuCvtColorTest CV_GpuCvtColor_test;
|
@@ -69,7 +69,7 @@ protected:
|
||||
|
||||
int test8UC4(const Mat& img)
|
||||
{
|
||||
cv::Mat img_C4;
|
||||
cv::Mat img_C4;
|
||||
cvtColor(img, img_C4, CV_BGR2BGRA);
|
||||
return test(img_C4);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ void CV_GpuNppMorphogyTest::run( int )
|
||||
{
|
||||
ts->set_failed_test_info(testResult);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(const cv::Exception& e)
|
||||
{
|
||||
@@ -134,10 +134,10 @@ protected:
|
||||
virtual int test(const Mat& img)
|
||||
{
|
||||
GpuMat kernel(Mat::ones(3, 3, CV_8U));
|
||||
Point anchor(-1, -1);
|
||||
int iters = 3;
|
||||
Point anchor(0, 0);
|
||||
int iters = 1;
|
||||
|
||||
cv::Mat cpuRes;
|
||||
cv::Mat cpuRes, cpuRes1;
|
||||
cv::erode(img, cpuRes, kernel, anchor, iters);
|
||||
|
||||
GpuMat gpuRes;
|
||||
@@ -158,13 +158,13 @@ protected:
|
||||
virtual int test(const Mat& img)
|
||||
{
|
||||
GpuMat kernel(Mat::ones(3, 3, CV_8U));
|
||||
Point anchor(-1, -1);
|
||||
int iters = 3;
|
||||
Point anchor(0, 0);
|
||||
int iters = 1;
|
||||
|
||||
cv::Mat cpuRes;
|
||||
cv::Mat cpuRes, cpuRes1;
|
||||
cv::dilate(img, cpuRes, kernel, anchor, iters);
|
||||
|
||||
GpuMat gpuRes;
|
||||
GpuMat gpuRes, gpuRes1;
|
||||
cv::gpu::dilate(GpuMat(img), gpuRes, kernel, anchor, iters);
|
||||
|
||||
return CheckNorm(cpuRes, gpuRes);
|
||||
@@ -186,8 +186,8 @@ protected:
|
||||
int num = sizeof(ops)/sizeof(ops[0]);
|
||||
|
||||
GpuMat kernel(Mat::ones(3, 3, CV_8U));
|
||||
Point anchor(-1, -1);
|
||||
int iters = 3;
|
||||
Point anchor(0, 0);
|
||||
int iters = 1;
|
||||
|
||||
for(int i = 0; i < num; ++i)
|
||||
{
|
||||
|
@@ -83,8 +83,6 @@ void CV_GpuMatOpConvertToTest::run(int /* start_from */)
|
||||
const int dst_type = types[j];
|
||||
|
||||
cv::RNG rng(*ts->get_rng());
|
||||
const double alpha = rng.uniform(0.0, 2.0);
|
||||
const double beta = rng.uniform(-75.0, 75.0);
|
||||
|
||||
Mat cpumatsrc(img_size, src_type);
|
||||
rng.fill(cpumatsrc, RNG::UNIFORM, Scalar::all(0), Scalar::all(300));
|
||||
@@ -93,8 +91,8 @@ void CV_GpuMatOpConvertToTest::run(int /* start_from */)
|
||||
Mat cpumatdst;
|
||||
GpuMat gpumatdst;
|
||||
|
||||
cpumatsrc.convertTo(cpumatdst, dst_type, alpha, beta);
|
||||
gpumatsrc.convertTo(gpumatdst, dst_type, alpha, beta);
|
||||
cpumatsrc.convertTo(cpumatdst, dst_type);
|
||||
gpumatsrc.convertTo(gpumatdst, dst_type);
|
||||
|
||||
double r = norm(cpumatdst, gpumatdst, NORM_INF);
|
||||
if (r > 1)
|
||||
|
Reference in New Issue
Block a user