diff --git a/modules/cudev/include/opencv2/cudev/functional/detail/color_cvt.hpp b/modules/cudev/include/opencv2/cudev/functional/detail/color_cvt.hpp index 59472142f9..a456dfad48 100644 --- a/modules/cudev/include/opencv2/cudev/functional/detail/color_cvt.hpp +++ b/modules/cudev/include/opencv2/cudev/functional/detail/color_cvt.hpp @@ -342,15 +342,15 @@ namespace color_cvt_detail const int delta = ColorChannel::half() * (1 << yuv_shift); - const int Y = CV_CUDEV_DESCALE(b * c_RGB2YUVCoeffs_i[2] + g * c_RGB2YUVCoeffs_i[1] + r * c_RGB2YUVCoeffs_i[0], yuv_shift); - const int Cr = CV_CUDEV_DESCALE((r - Y) * c_RGB2YUVCoeffs_i[3] + delta, yuv_shift); - const int Cb = CV_CUDEV_DESCALE((b - Y) * c_RGB2YUVCoeffs_i[4] + delta, yuv_shift); + const int Y = CV_CUDEV_DESCALE(b * c_RGB2YUVCoeffs_i[0] + g * c_RGB2YUVCoeffs_i[1] + r * c_RGB2YUVCoeffs_i[2], yuv_shift); + const int Cb = CV_CUDEV_DESCALE((b - Y) * c_RGB2YUVCoeffs_i[3] + delta, yuv_shift); + const int Cr = CV_CUDEV_DESCALE((r - Y) * c_RGB2YUVCoeffs_i[4] + delta, yuv_shift); typename MakeVec::type dst; dst.x = saturate_cast(Y); - dst.y = saturate_cast(Cr); - dst.z = saturate_cast(Cb); + dst.y = saturate_cast(Cb); + dst.z = saturate_cast(Cr); return dst; } @@ -367,9 +367,9 @@ namespace color_cvt_detail typename MakeVec::type dst; - dst.x = b * c_RGB2YUVCoeffs_f[2] + g * c_RGB2YUVCoeffs_f[1] + r * c_RGB2YUVCoeffs_f[0]; - dst.y = (r - dst.x) * c_RGB2YUVCoeffs_f[3] + ColorChannel::half(); - dst.z = (b - dst.x) * c_RGB2YUVCoeffs_f[4] + ColorChannel::half(); + dst.x = b * c_RGB2YUVCoeffs_f[0] + g * c_RGB2YUVCoeffs_f[1] + r * c_RGB2YUVCoeffs_f[2]; + dst.y = (b - dst.x) * c_RGB2YUVCoeffs_f[3] + ColorChannel::half(); + dst.z = (r - dst.x) * c_RGB2YUVCoeffs_f[4] + ColorChannel::half(); return dst; } @@ -385,9 +385,9 @@ namespace color_cvt_detail { __device__ typename MakeVec::type operator ()(const typename MakeVec::type& src) const { - const int b = src.x + CV_CUDEV_DESCALE((src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[3], yuv_shift); + const int r = src.x + CV_CUDEV_DESCALE((src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[3], yuv_shift); const int g = src.x + CV_CUDEV_DESCALE((src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_i[2] + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[1], yuv_shift); - const int r = src.x + CV_CUDEV_DESCALE((src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[0], yuv_shift); + const int b = src.x + CV_CUDEV_DESCALE((src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_i[0], yuv_shift); typename MakeVec::type dst; @@ -405,9 +405,9 @@ namespace color_cvt_detail { __device__ typename MakeVec::type operator ()(const typename MakeVec::type& src) const { - const float b = src.x + (src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_f[3]; + const float r = src.x + (src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_f[3]; const float g = src.x + (src.z - ColorChannel::half()) * c_YUV2RGBCoeffs_f[2] + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_f[1]; - const float r = src.x + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_f[0]; + const float b = src.x + (src.y - ColorChannel::half()) * c_YUV2RGBCoeffs_f[0]; typename MakeVec::type dst;