1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-21 06:11:09 +08:00

Implement cv::cuda::inRange (Fixes OpenCV #6295)

This commit is contained in:
Aaron Miller
2021-01-01 20:44:58 -05:00
parent 33ae078b09
commit f1c0b5eae6
7 changed files with 391 additions and 1 deletions

View File

@@ -1501,4 +1501,41 @@ PERF_TEST_P(Sz_Depth_Op, Threshold,
}
}
//////////////////////////////////////////////////////////////////////
// InRange
PERF_TEST_P(Sz_Depth_Cn, InRange,
Combine(CUDA_TYPICAL_MAT_SIZES,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
CUDA_CHANNELS_1_3_4))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const int channels = GET_PARAM(2);
cv::Mat src(size, CV_MAKE_TYPE(depth, channels));
declare.in(src, WARMUP_RNG);
const cv::Scalar lowerb(10, 50, 100);
const cv::Scalar upperb(70, 85, 200);
if (PERF_RUN_CUDA())
{
const cv::cuda::GpuMat d_src(src);
cv::cuda::GpuMat dst;
TEST_CYCLE() cv::cuda::inRange(d_src, lowerb, upperb, dst);
CUDA_SANITY_CHECK(dst, 0);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::inRange(src, lowerb, upperb, dst);
CPU_SANITY_CHECK(dst);
}
}
}} // namespace