Add CV_16UC1 support for cuda::CLAHE

Due to size limit of shared memory, histogram is built on
the global memory for CV_16UC1 case.

The amount of memory needed for building histogram is:

    65536 * 4byte = 256KB

and shared memory limit is 48KB typically.

Added test cases for CV_16UC1 and various clip limits.
Added perf tests for CV_16UC1 on both CPU and CUDA code.

There was also a bug in CV_8UC1 case when redistributing
"residual" clipped pixels. Adding the test case where clip
limit is 5.0 exposes this bug.
This commit is contained in:
Namgoo Lee
2019-02-05 16:37:33 +00:00
parent a63f66c90e
commit fb8e652c3f
6 changed files with 285 additions and 31 deletions
+5 -3
View File
@@ -141,18 +141,20 @@ PERF_TEST_P(Dim_Cmpmethod, compareHist,
SANITY_CHECK_NOTHING();
}
typedef tuple<Size, double> Sz_ClipLimit_t;
typedef tuple<Size, double, MatType> Sz_ClipLimit_t;
typedef TestBaseWithParam<Sz_ClipLimit_t> Sz_ClipLimit;
PERF_TEST_P(Sz_ClipLimit, CLAHE,
testing::Combine(testing::Values(::perf::szVGA, ::perf::sz720p, ::perf::sz1080p),
testing::Values(0.0, 40.0))
testing::Values(0.0, 40.0),
testing::Values(MatType(CV_8UC1), MatType(CV_16UC1)))
)
{
const Size size = get<0>(GetParam());
const double clipLimit = get<1>(GetParam());
const int type = get<2>(GetParam());
Mat src(size, CV_8UC1);
Mat src(size, type);
declare.in(src, WARMUP_RNG);
Ptr<CLAHE> clahe = createCLAHE(clipLimit);