#endif\r
}\r
\r
+ void rgb_to_lab(const GpuMat& src, GpuMat& dst, int, Stream& stream)\r
+ {\r
+ bgr_to_rgb(src, dst, -1, stream);\r
+ bgr_to_lab(dst, dst, -1, stream);\r
+ }\r
+\r
void lab_to_bgr(const GpuMat& src, GpuMat& dst, int dcn, Stream& stream)\r
{\r
#if (CUDA_VERSION < 5000)\r
#endif\r
}\r
\r
+ void lab_to_rgb(const GpuMat& src, GpuMat& dst, int, Stream& stream)\r
+ {\r
+ lab_to_bgr(src, dst, -1, stream);\r
+ bgr_to_rgb(dst, dst, -1, stream);\r
+ }\r
+\r
void rgb_to_luv(const GpuMat& src, GpuMat& dst, int dcn, Stream& stream)\r
{\r
#if (CUDA_VERSION < 5000)\r
#endif\r
}\r
\r
+ void bgr_to_luv(const GpuMat& src, GpuMat& dst, int, Stream& stream)\r
+ {\r
+ bgr_to_rgb(src, dst, -1, stream);\r
+ rgb_to_luv(dst, dst, -1, stream);\r
+ }\r
+\r
void luv_to_rgb(const GpuMat& src, GpuMat& dst, int dcn, Stream& stream)\r
{\r
#if (CUDA_VERSION < 5000)\r
nppSafeCall( nppiLUVToRGB_8u_AC4R(src.ptr<Npp8u>(), static_cast<int>(src.step), dst.ptr<Npp8u>(), static_cast<int>(dst.step), oSizeROI) );\r
#endif\r
}\r
+\r
+ void luv_to_bgr(const GpuMat& src, GpuMat& dst, int, Stream& stream)\r
+ {\r
+ luv_to_rgb(src, dst, -1, stream);\r
+ bgr_to_rgb(dst, dst, -1, stream);\r
+ }\r
}\r
\r
void cv::gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, Stream& stream)\r
0, // =43\r
\r
bgr_to_lab, // CV_BGR2Lab =44\r
- 0, // CV_RGB2Lab =45\r
+ rgb_to_lab, // CV_RGB2Lab =45\r
\r
0, // CV_BayerBG2BGR =46\r
0, // CV_BayerGB2BGR =47\r
0, // CV_BayerRG2BGR =48\r
0, // CV_BayerGR2BGR =49\r
\r
- 0, // CV_BGR2Luv =50\r
+ bgr_to_luv, // CV_BGR2Luv =50\r
rgb_to_luv, // CV_RGB2Luv =51\r
\r
bgr_to_hls, // CV_BGR2HLS =52\r
hsv_to_rgb, // CV_HSV2RGB =55\r
\r
lab_to_bgr, // CV_Lab2BGR =56\r
- 0, // CV_Lab2RGB =57\r
- 0, // CV_Luv2BGR =58\r
+ lab_to_rgb, // CV_Lab2RGB =57\r
+ luv_to_bgr, // CV_Luv2BGR =58\r
luv_to_rgb, // CV_Luv2RGB =59\r
\r
hls_to_bgr, // CV_HLS2BGR =60\r
}
catch (const cv::Exception& e)
{
+#if (CUDA_VERSION < 5000)
ASSERT_EQ(CV_StsBadFlag, e.code);
+#else
+ FAIL();
+#endif
+ }
+}
+
+TEST_P(CvtColor, RGB2Lab)
+{
+ if (depth != CV_8U)
+ return;
+
+ try
+ {
+ cv::Mat src = readImage("stereobm/aloe-L.png");
+
+ cv::gpu::GpuMat dst_lab = createMat(src.size(), src.type(), useRoi);
+ cv::gpu::cvtColor(loadMat(src, useRoi), dst_lab, cv::COLOR_RGB2Lab);
+
+ cv::gpu::GpuMat dst_bgr = createMat(src.size(), src.type(), useRoi);
+ cv::gpu::cvtColor(dst_lab, dst_bgr, cv::COLOR_Lab2RGB);
+
+ EXPECT_MAT_NEAR(src, dst_bgr, 10);
+ }
+ catch (const cv::Exception& e)
+ {
+#if (CUDA_VERSION < 5000)
+ ASSERT_EQ(CV_StsBadFlag, e.code);
+#else
+ FAIL();
+#endif
}
}
cv::Mat src = img;
cv::gpu::GpuMat dst_luv = createMat(src.size(), src.type(), useRoi);
+ cv::gpu::cvtColor(loadMat(src, useRoi), dst_luv, cv::COLOR_BGR2Luv);
+
+ cv::gpu::GpuMat dst_rgb = createMat(src.size(), src.type(), useRoi);
+ cv::gpu::cvtColor(dst_luv, dst_rgb, cv::COLOR_Luv2BGR);
+
+ EXPECT_MAT_NEAR(src, dst_rgb, 10);
+ }
+ catch (const cv::Exception& e)
+ {
+#if (CUDA_VERSION < 5000)
+ ASSERT_EQ(CV_StsBadFlag, e.code);
+#else
+ FAIL();
+#endif
+ }
+}
+
+TEST_P(CvtColor, RGB2Luv)
+{
+ if (depth != CV_8U)
+ return;
+
+ try
+ {
+ cv::Mat src = img;
+
+ cv::gpu::GpuMat dst_luv = createMat(src.size(), src.type(), useRoi);
cv::gpu::cvtColor(loadMat(src, useRoi), dst_luv, cv::COLOR_RGB2Luv);
cv::gpu::GpuMat dst_rgb = createMat(src.size(), src.type(), useRoi);
}
catch (const cv::Exception& e)
{
+#if (CUDA_VERSION < 5000)
ASSERT_EQ(CV_StsBadFlag, e.code);
+#else
+ FAIL();
+#endif
}
}