Home | History | Annotate | Download | only in functional
      1 /*M///////////////////////////////////////////////////////////////////////////////////////
      2 //
      3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
      4 //
      5 //  By downloading, copying, installing or using the software you agree to this license.
      6 //  If you do not agree to this license, do not download, install,
      7 //  copy or use the software.
      8 //
      9 //
     10 //                          License Agreement
     11 //                For Open Source Computer Vision Library
     12 //
     13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
     14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
     15 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
     16 // Third party copyrights are property of their respective owners.
     17 //
     18 // Redistribution and use in source and binary forms, with or without modification,
     19 // are permitted provided that the following conditions are met:
     20 //
     21 //   * Redistribution's of source code must retain the above copyright notice,
     22 //     this list of conditions and the following disclaimer.
     23 //
     24 //   * Redistribution's in binary form must reproduce the above copyright notice,
     25 //     this list of conditions and the following disclaimer in the documentation
     26 //     and/or other materials provided with the distribution.
     27 //
     28 //   * The name of the copyright holders may not be used to endorse or promote products
     29 //     derived from this software without specific prior written permission.
     30 //
     31 // This software is provided by the copyright holders and contributors "as is" and
     32 // any express or implied warranties, including, but not limited to, the implied
     33 // warranties of merchantability and fitness for a particular purpose are disclaimed.
     34 // In no event shall the Intel Corporation or contributors be liable for any direct,
     35 // indirect, incidental, special, exemplary, or consequential damages
     36 // (including, but not limited to, procurement of substitute goods or services;
     37 // loss of use, data, or profits; or business interruption) however caused
     38 // and on any theory of liability, whether in contract, strict liability,
     39 // or tort (including negligence or otherwise) arising in any way out of
     40 // the use of this software, even if advised of the possibility of such damage.
     41 //
     42 //M*/
     43 
     44 #pragma once
     45 
     46 #ifndef __OPENCV_CUDEV_FUNCTIONAL_COLOR_CVT_HPP__
     47 #define __OPENCV_CUDEV_FUNCTIONAL_COLOR_CVT_HPP__
     48 
     49 #include "../common.hpp"
     50 #include "detail/color_cvt.hpp"
     51 
     52 namespace cv { namespace cudev {
     53 
     54 //! @addtogroup cudev
     55 //! @{
     56 
     57 // Various 3/4-channel to 3/4-channel RGB transformations
     58 
     59 #define CV_CUDEV_RGB2RGB_INST(name, scn, dcn, bidx) \
     60     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2RGB<SrcDepth, scn, dcn, bidx> \
     61     { \
     62     };
     63 
     64 CV_CUDEV_RGB2RGB_INST(BGR_to_RGB, 3, 3, 2)
     65 CV_CUDEV_RGB2RGB_INST(BGR_to_BGRA, 3, 4, 0)
     66 CV_CUDEV_RGB2RGB_INST(BGR_to_RGBA, 3, 4, 2)
     67 CV_CUDEV_RGB2RGB_INST(BGRA_to_BGR, 4, 3, 0)
     68 CV_CUDEV_RGB2RGB_INST(BGRA_to_RGB, 4, 3, 2)
     69 CV_CUDEV_RGB2RGB_INST(BGRA_to_RGBA, 4, 4, 2)
     70 
     71 #undef CV_CUDEV_RGB2RGB_INST
     72 
     73 // RGB to Grayscale
     74 
     75 #define CV_CUDEV_RGB2GRAY_INST(name, scn, bidx) \
     76     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2Gray<SrcDepth, scn, bidx> \
     77     { \
     78     };
     79 
     80 CV_CUDEV_RGB2GRAY_INST(RGB_to_GRAY, 3, 2)
     81 CV_CUDEV_RGB2GRAY_INST(BGR_to_GRAY, 3, 0)
     82 CV_CUDEV_RGB2GRAY_INST(RGBA_to_GRAY, 4, 2)
     83 CV_CUDEV_RGB2GRAY_INST(BGRA_to_GRAY, 4, 0)
     84 
     85 #undef CV_CUDEV_RGB2GRAY_INST
     86 
     87 // Grayscale to RGB
     88 
     89 #define CV_CUDEV_GRAY2RGB_INST(name, dcn) \
     90     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::Gray2RGB<SrcDepth, dcn> \
     91     { \
     92     };
     93 
     94 CV_CUDEV_GRAY2RGB_INST(GRAY_to_BGR, 3)
     95 CV_CUDEV_GRAY2RGB_INST(GRAY_to_BGRA, 4)
     96 
     97 #undef CV_CUDEV_GRAY2RGB_INST
     98 
     99 // RGB to YUV
    100 
    101 #define CV_CUDEV_RGB2YUV_INST(name, scn, dcn, bidx) \
    102     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2YUV<SrcDepth, scn, dcn, bidx> \
    103     { \
    104     };
    105 
    106 CV_CUDEV_RGB2YUV_INST(RGB_to_YUV, 3, 3, 2)
    107 CV_CUDEV_RGB2YUV_INST(RGBA_to_YUV, 4, 3, 2)
    108 CV_CUDEV_RGB2YUV_INST(RGB_to_YUV4, 3, 4, 2)
    109 CV_CUDEV_RGB2YUV_INST(RGBA_to_YUV4, 4, 4, 2)
    110 CV_CUDEV_RGB2YUV_INST(BGR_to_YUV, 3, 3, 0)
    111 CV_CUDEV_RGB2YUV_INST(BGRA_to_YUV, 4, 3, 0)
    112 CV_CUDEV_RGB2YUV_INST(BGR_to_YUV4, 3, 4, 0)
    113 CV_CUDEV_RGB2YUV_INST(BGRA_to_YUV4, 4, 4, 0)
    114 
    115 #undef CV_CUDEV_RGB2YUV_INST
    116 
    117 // YUV to RGB
    118 
    119 #define CV_CUDEV_YUV2RGB_INST(name, scn, dcn, bidx) \
    120     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::YUV2RGB<SrcDepth, scn, dcn, bidx> \
    121     { \
    122     };
    123 
    124 CV_CUDEV_YUV2RGB_INST(YUV_to_RGB, 3, 3, 2)
    125 CV_CUDEV_YUV2RGB_INST(YUV_to_RGBA, 3, 4, 2)
    126 CV_CUDEV_YUV2RGB_INST(YUV4_to_RGB, 4, 3, 2)
    127 CV_CUDEV_YUV2RGB_INST(YUV4_to_RGBA, 4, 4, 2)
    128 CV_CUDEV_YUV2RGB_INST(YUV_to_BGR, 3, 3, 0)
    129 CV_CUDEV_YUV2RGB_INST(YUV_to_BGRA, 3, 4, 0)
    130 CV_CUDEV_YUV2RGB_INST(YUV4_to_BGR, 4, 3, 0)
    131 CV_CUDEV_YUV2RGB_INST(YUV4_to_BGRA, 4, 4, 0)
    132 
    133 #undef CV_CUDEV_YUV2RGB_INST
    134 
    135 // RGB to YCrCb
    136 
    137 #define CV_CUDEV_RGB2YCrCb_INST(name, scn, dcn, bidx) \
    138     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2YCrCb<SrcDepth, scn, dcn, bidx> \
    139     { \
    140     };
    141 
    142 CV_CUDEV_RGB2YCrCb_INST(RGB_to_YCrCb, 3, 3, 2)
    143 CV_CUDEV_RGB2YCrCb_INST(RGBA_to_YCrCb, 4, 3, 2)
    144 CV_CUDEV_RGB2YCrCb_INST(RGB_to_YCrCb4, 3, 4, 2)
    145 CV_CUDEV_RGB2YCrCb_INST(RGBA_to_YCrCb4, 4, 4, 2)
    146 CV_CUDEV_RGB2YCrCb_INST(BGR_to_YCrCb, 3, 3, 0)
    147 CV_CUDEV_RGB2YCrCb_INST(BGRA_to_YCrCb, 4, 3, 0)
    148 CV_CUDEV_RGB2YCrCb_INST(BGR_to_YCrCb4, 3, 4, 0)
    149 CV_CUDEV_RGB2YCrCb_INST(BGRA_to_YCrCb4, 4, 4, 0)
    150 
    151 #undef CV_CUDEV_RGB2YCrCb_INST
    152 
    153 // YCrCb to RGB
    154 
    155 #define CV_CUDEV_YCrCb2RGB_INST(name, scn, dcn, bidx) \
    156     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::YCrCb2RGB<SrcDepth, scn, dcn, bidx> \
    157     { \
    158     };
    159 
    160 CV_CUDEV_YCrCb2RGB_INST(YCrCb_to_RGB, 3, 3, 2)
    161 CV_CUDEV_YCrCb2RGB_INST(YCrCb_to_RGBA, 3, 4, 2)
    162 CV_CUDEV_YCrCb2RGB_INST(YCrCb4_to_RGB, 4, 3, 2)
    163 CV_CUDEV_YCrCb2RGB_INST(YCrCb4_to_RGBA, 4, 4, 2)
    164 CV_CUDEV_YCrCb2RGB_INST(YCrCb_to_BGR, 3, 3, 0)
    165 CV_CUDEV_YCrCb2RGB_INST(YCrCb_to_BGRA, 3, 4, 0)
    166 CV_CUDEV_YCrCb2RGB_INST(YCrCb4_to_BGR, 4, 3, 0)
    167 CV_CUDEV_YCrCb2RGB_INST(YCrCb4_to_BGRA, 4, 4, 0)
    168 
    169 #undef CV_CUDEV_YCrCb2RGB_INST
    170 
    171 // RGB to XYZ
    172 
    173 #define CV_CUDEV_RGB2XYZ_INST(name, scn, dcn, bidx) \
    174     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2XYZ<SrcDepth, scn, dcn, bidx> \
    175     { \
    176     };
    177 
    178 CV_CUDEV_RGB2XYZ_INST(RGB_to_XYZ, 3, 3, 2)
    179 CV_CUDEV_RGB2XYZ_INST(RGBA_to_XYZ, 4, 3, 2)
    180 CV_CUDEV_RGB2XYZ_INST(RGB_to_XYZ4, 3, 4, 2)
    181 CV_CUDEV_RGB2XYZ_INST(RGBA_to_XYZ4, 4, 4, 2)
    182 CV_CUDEV_RGB2XYZ_INST(BGR_to_XYZ, 3, 3, 0)
    183 CV_CUDEV_RGB2XYZ_INST(BGRA_to_XYZ, 4, 3, 0)
    184 CV_CUDEV_RGB2XYZ_INST(BGR_to_XYZ4, 3, 4, 0)
    185 CV_CUDEV_RGB2XYZ_INST(BGRA_to_XYZ4, 4, 4, 0)
    186 
    187 #undef CV_CUDEV_RGB2XYZ_INST
    188 
    189 // XYZ to RGB
    190 
    191 #define CV_CUDEV_XYZ2RGB_INST(name, scn, dcn, bidx) \
    192     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::XYZ2RGB<SrcDepth, scn, dcn, bidx> \
    193     { \
    194     };
    195 
    196 CV_CUDEV_XYZ2RGB_INST(XYZ_to_RGB, 3, 3, 2)
    197 CV_CUDEV_XYZ2RGB_INST(XYZ4_to_RGB, 4, 3, 2)
    198 CV_CUDEV_XYZ2RGB_INST(XYZ_to_RGBA, 3, 4, 2)
    199 CV_CUDEV_XYZ2RGB_INST(XYZ4_to_RGBA, 4, 4, 2)
    200 CV_CUDEV_XYZ2RGB_INST(XYZ_to_BGR, 3, 3, 0)
    201 CV_CUDEV_XYZ2RGB_INST(XYZ4_to_BGR, 4, 3, 0)
    202 CV_CUDEV_XYZ2RGB_INST(XYZ_to_BGRA, 3, 4, 0)
    203 CV_CUDEV_XYZ2RGB_INST(XYZ4_to_BGRA, 4, 4, 0)
    204 
    205 #undef CV_CUDEV_XYZ2RGB_INST
    206 
    207 // RGB to HSV
    208 
    209 #define CV_CUDEV_RGB2HSV_INST(name, scn, dcn, bidx) \
    210     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2HSV<SrcDepth, scn, dcn, bidx, 180> \
    211     { \
    212     }; \
    213     template <typename SrcDepth> struct name ## _FULL ## _func : cv::cudev::color_cvt_detail::RGB2HSV<SrcDepth, scn, dcn, bidx, 256> \
    214     { \
    215     }; \
    216     template <> struct name ## _func<float> : cv::cudev::color_cvt_detail::RGB2HSV<float, scn, dcn, bidx, 360> \
    217     { \
    218     }; \
    219     template <> struct name ## _FULL ## _func<float> : cv::cudev::color_cvt_detail::RGB2HSV<float, scn, dcn, bidx, 360> \
    220     { \
    221     };
    222 
    223 CV_CUDEV_RGB2HSV_INST(RGB_to_HSV, 3, 3, 2)
    224 CV_CUDEV_RGB2HSV_INST(RGBA_to_HSV, 4, 3, 2)
    225 CV_CUDEV_RGB2HSV_INST(RGB_to_HSV4, 3, 4, 2)
    226 CV_CUDEV_RGB2HSV_INST(RGBA_to_HSV4, 4, 4, 2)
    227 CV_CUDEV_RGB2HSV_INST(BGR_to_HSV, 3, 3, 0)
    228 CV_CUDEV_RGB2HSV_INST(BGRA_to_HSV, 4, 3, 0)
    229 CV_CUDEV_RGB2HSV_INST(BGR_to_HSV4, 3, 4, 0)
    230 CV_CUDEV_RGB2HSV_INST(BGRA_to_HSV4, 4, 4, 0)
    231 
    232 #undef CV_CUDEV_RGB2HSV_INST
    233 
    234 // HSV to RGB
    235 
    236 #define CV_CUDEV_HSV2RGB_INST(name, scn, dcn, bidx) \
    237     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::HSV2RGB<SrcDepth, scn, dcn, bidx, 180> \
    238     { \
    239     }; \
    240     template <typename SrcDepth> struct name ## _FULL ## _func : cv::cudev::color_cvt_detail::HSV2RGB<SrcDepth, scn, dcn, bidx, 255> \
    241     { \
    242     }; \
    243     template <> struct name ## _func<float> : cv::cudev::color_cvt_detail::HSV2RGB<float, scn, dcn, bidx, 360> \
    244     { \
    245     }; \
    246     template <> struct name ## _FULL ## _func<float> : cv::cudev::color_cvt_detail::HSV2RGB<float, scn, dcn, bidx, 360> \
    247     { \
    248     };
    249 
    250 CV_CUDEV_HSV2RGB_INST(HSV_to_RGB, 3, 3, 2)
    251 CV_CUDEV_HSV2RGB_INST(HSV_to_RGBA, 3, 4, 2)
    252 CV_CUDEV_HSV2RGB_INST(HSV4_to_RGB, 4, 3, 2)
    253 CV_CUDEV_HSV2RGB_INST(HSV4_to_RGBA, 4, 4, 2)
    254 CV_CUDEV_HSV2RGB_INST(HSV_to_BGR, 3, 3, 0)
    255 CV_CUDEV_HSV2RGB_INST(HSV_to_BGRA, 3, 4, 0)
    256 CV_CUDEV_HSV2RGB_INST(HSV4_to_BGR, 4, 3, 0)
    257 CV_CUDEV_HSV2RGB_INST(HSV4_to_BGRA, 4, 4, 0)
    258 
    259 #undef CV_CUDEV_HSV2RGB_INST
    260 
    261 // RGB to HLS
    262 
    263 #define CV_CUDEV_RGB2HLS_INST(name, scn, dcn, bidx) \
    264     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2HLS<SrcDepth, scn, dcn, bidx, 180> \
    265     { \
    266     }; \
    267     template <typename SrcDepth> struct name ## _FULL ## _func : cv::cudev::color_cvt_detail::RGB2HLS<SrcDepth, scn, dcn, bidx, 256> \
    268     { \
    269     }; \
    270     template <> struct name ## _func<float> : cv::cudev::color_cvt_detail::RGB2HLS<float, scn, dcn, bidx, 360> \
    271     { \
    272     }; \
    273     template <> struct name ## _FULL ## _func<float> : cv::cudev::color_cvt_detail::RGB2HLS<float, scn, dcn, bidx, 360> \
    274     { \
    275     };
    276 
    277 CV_CUDEV_RGB2HLS_INST(RGB_to_HLS, 3, 3, 2)
    278 CV_CUDEV_RGB2HLS_INST(RGBA_to_HLS, 4, 3, 2)
    279 CV_CUDEV_RGB2HLS_INST(RGB_to_HLS4, 3, 4, 2)
    280 CV_CUDEV_RGB2HLS_INST(RGBA_to_HLS4, 4, 4, 2)
    281 CV_CUDEV_RGB2HLS_INST(BGR_to_HLS, 3, 3, 0)
    282 CV_CUDEV_RGB2HLS_INST(BGRA_to_HLS, 4, 3, 0)
    283 CV_CUDEV_RGB2HLS_INST(BGR_to_HLS4, 3, 4, 0)
    284 CV_CUDEV_RGB2HLS_INST(BGRA_to_HLS4, 4, 4, 0)
    285 
    286 #undef CV_CUDEV_RGB2HLS_INST
    287 
    288 // HLS to RGB
    289 
    290 #define CV_CUDEV_HLS2RGB_INST(name, scn, dcn, bidx) \
    291     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::HLS2RGB<SrcDepth, scn, dcn, bidx, 180> \
    292     { \
    293     }; \
    294     template <typename SrcDepth> struct name ## _FULL ## _func : cv::cudev::color_cvt_detail::HLS2RGB<SrcDepth, scn, dcn, bidx, 255> \
    295     { \
    296     }; \
    297     template <> struct name ## _func<float> : cv::cudev::color_cvt_detail::HLS2RGB<float, scn, dcn, bidx, 360> \
    298     { \
    299     }; \
    300     template <> struct name ## _FULL ## _func<float> : cv::cudev::color_cvt_detail::HLS2RGB<float, scn, dcn, bidx, 360> \
    301     { \
    302     };
    303 
    304 CV_CUDEV_HLS2RGB_INST(HLS_to_RGB, 3, 3, 2)
    305 CV_CUDEV_HLS2RGB_INST(HLS_to_RGBA, 3, 4, 2)
    306 CV_CUDEV_HLS2RGB_INST(HLS4_to_RGB, 4, 3, 2)
    307 CV_CUDEV_HLS2RGB_INST(HLS4_to_RGBA, 4, 4, 2)
    308 CV_CUDEV_HLS2RGB_INST(HLS_to_BGR, 3, 3, 0)
    309 CV_CUDEV_HLS2RGB_INST(HLS_to_BGRA, 3, 4, 0)
    310 CV_CUDEV_HLS2RGB_INST(HLS4_to_BGR, 4, 3, 0)
    311 CV_CUDEV_HLS2RGB_INST(HLS4_to_BGRA, 4, 4, 0)
    312 
    313 #undef CV_CUDEV_HLS2RGB_INST
    314 
    315 // RGB to Lab
    316 
    317 #define CV_CUDEV_RGB2Lab_INST(name, scn, dcn, sRGB, blueIdx) \
    318     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2Lab<SrcDepth, scn, dcn, sRGB, blueIdx> \
    319     { \
    320     };
    321 
    322 CV_CUDEV_RGB2Lab_INST(RGB_to_Lab, 3, 3, true, 2)
    323 CV_CUDEV_RGB2Lab_INST(RGBA_to_Lab, 4, 3, true, 2)
    324 CV_CUDEV_RGB2Lab_INST(RGB_to_Lab4, 3, 4, true, 2)
    325 CV_CUDEV_RGB2Lab_INST(RGBA_to_Lab4, 4, 4, true, 2)
    326 CV_CUDEV_RGB2Lab_INST(BGR_to_Lab, 3, 3, true, 0)
    327 CV_CUDEV_RGB2Lab_INST(BGRA_to_Lab, 4, 3, true, 0)
    328 CV_CUDEV_RGB2Lab_INST(BGR_to_Lab4, 3, 4, true, 0)
    329 CV_CUDEV_RGB2Lab_INST(BGRA_to_Lab4, 4, 4, true, 0)
    330 
    331 CV_CUDEV_RGB2Lab_INST(LRGB_to_Lab, 3, 3, false, 2)
    332 CV_CUDEV_RGB2Lab_INST(LRGBA_to_Lab, 4, 3, false, 2)
    333 CV_CUDEV_RGB2Lab_INST(LRGB_to_Lab4, 3, 4, false, 2)
    334 CV_CUDEV_RGB2Lab_INST(LRGBA_to_Lab4, 4, 4, false, 2)
    335 CV_CUDEV_RGB2Lab_INST(LBGR_to_Lab, 3, 3, false, 0)
    336 CV_CUDEV_RGB2Lab_INST(LBGRA_to_Lab, 4, 3, false, 0)
    337 CV_CUDEV_RGB2Lab_INST(LBGR_to_Lab4, 3, 4, false, 0)
    338 CV_CUDEV_RGB2Lab_INST(LBGRA_to_Lab4, 4, 4, false, 0)
    339 
    340 #undef CV_CUDEV_RGB2Lab_INST
    341 
    342 // Lab to RGB
    343 
    344 #define CV_CUDEV_Lab2RGB_INST(name, scn, dcn, sRGB, blueIdx) \
    345     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::Lab2RGB<SrcDepth, scn, dcn, sRGB, blueIdx> \
    346     { \
    347     };
    348 
    349 CV_CUDEV_Lab2RGB_INST(Lab_to_RGB, 3, 3, true, 2)
    350 CV_CUDEV_Lab2RGB_INST(Lab4_to_RGB, 4, 3, true, 2)
    351 CV_CUDEV_Lab2RGB_INST(Lab_to_RGBA, 3, 4, true, 2)
    352 CV_CUDEV_Lab2RGB_INST(Lab4_to_RGBA, 4, 4, true, 2)
    353 CV_CUDEV_Lab2RGB_INST(Lab_to_BGR, 3, 3, true, 0)
    354 CV_CUDEV_Lab2RGB_INST(Lab4_to_BGR, 4, 3, true, 0)
    355 CV_CUDEV_Lab2RGB_INST(Lab_to_BGRA, 3, 4, true, 0)
    356 CV_CUDEV_Lab2RGB_INST(Lab4_to_BGRA, 4, 4, true, 0)
    357 
    358 CV_CUDEV_Lab2RGB_INST(Lab_to_LRGB, 3, 3, false, 2)
    359 CV_CUDEV_Lab2RGB_INST(Lab4_to_LRGB, 4, 3, false, 2)
    360 CV_CUDEV_Lab2RGB_INST(Lab_to_LRGBA, 3, 4, false, 2)
    361 CV_CUDEV_Lab2RGB_INST(Lab4_to_LRGBA, 4, 4, false, 2)
    362 CV_CUDEV_Lab2RGB_INST(Lab_to_LBGR, 3, 3, false, 0)
    363 CV_CUDEV_Lab2RGB_INST(Lab4_to_LBGR, 4, 3, false, 0)
    364 CV_CUDEV_Lab2RGB_INST(Lab_to_LBGRA, 3, 4, false, 0)
    365 CV_CUDEV_Lab2RGB_INST(Lab4_to_LBGRA, 4, 4, false, 0)
    366 
    367 #undef CV_CUDEV_Lab2RGB_INST
    368 
    369 // RGB to Luv
    370 
    371 #define CV_CUDEV_RGB2Luv_INST(name, scn, dcn, sRGB, blueIdx) \
    372     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::RGB2Luv<SrcDepth, scn, dcn, sRGB, blueIdx> \
    373     { \
    374     };
    375 
    376 CV_CUDEV_RGB2Luv_INST(RGB_to_Luv, 3, 3, true, 2)
    377 CV_CUDEV_RGB2Luv_INST(RGBA_to_Luv, 4, 3, true, 2)
    378 CV_CUDEV_RGB2Luv_INST(RGB_to_Luv4, 3, 4, true, 2)
    379 CV_CUDEV_RGB2Luv_INST(RGBA_to_Luv4, 4, 4, true, 2)
    380 CV_CUDEV_RGB2Luv_INST(BGR_to_Luv, 3, 3, true, 0)
    381 CV_CUDEV_RGB2Luv_INST(BGRA_to_Luv, 4, 3, true, 0)
    382 CV_CUDEV_RGB2Luv_INST(BGR_to_Luv4, 3, 4, true, 0)
    383 CV_CUDEV_RGB2Luv_INST(BGRA_to_Luv4, 4, 4, true, 0)
    384 
    385 CV_CUDEV_RGB2Luv_INST(LRGB_to_Luv, 3, 3, false, 2)
    386 CV_CUDEV_RGB2Luv_INST(LRGBA_to_Luv, 4, 3, false, 2)
    387 CV_CUDEV_RGB2Luv_INST(LRGB_to_Luv4, 3, 4, false, 2)
    388 CV_CUDEV_RGB2Luv_INST(LRGBA_to_Luv4, 4, 4, false, 2)
    389 CV_CUDEV_RGB2Luv_INST(LBGR_to_Luv, 3, 3, false, 0)
    390 CV_CUDEV_RGB2Luv_INST(LBGRA_to_Luv, 4, 3, false, 0)
    391 CV_CUDEV_RGB2Luv_INST(LBGR_to_Luv4, 3, 4, false, 0)
    392 CV_CUDEV_RGB2Luv_INST(LBGRA_to_Luv4, 4, 4, false, 0)
    393 
    394 #undef CV_CUDEV_RGB2Luv_INST
    395 
    396 // Luv to RGB
    397 
    398 #define CV_CUDEV_Luv2RGB_INST(name, scn, dcn, sRGB, blueIdx) \
    399     template <typename SrcDepth> struct name ## _func : cv::cudev::color_cvt_detail::Luv2RGB<SrcDepth, scn, dcn, sRGB, blueIdx> \
    400     { \
    401     };
    402 
    403 CV_CUDEV_Luv2RGB_INST(Luv_to_RGB, 3, 3, true, 2)
    404 CV_CUDEV_Luv2RGB_INST(Luv4_to_RGB, 4, 3, true, 2)
    405 CV_CUDEV_Luv2RGB_INST(Luv_to_RGBA, 3, 4, true, 2)
    406 CV_CUDEV_Luv2RGB_INST(Luv4_to_RGBA, 4, 4, true, 2)
    407 CV_CUDEV_Luv2RGB_INST(Luv_to_BGR, 3, 3, true, 0)
    408 CV_CUDEV_Luv2RGB_INST(Luv4_to_BGR, 4, 3, true, 0)
    409 CV_CUDEV_Luv2RGB_INST(Luv_to_BGRA, 3, 4, true, 0)
    410 CV_CUDEV_Luv2RGB_INST(Luv4_to_BGRA, 4, 4, true, 0)
    411 
    412 CV_CUDEV_Luv2RGB_INST(Luv_to_LRGB, 3, 3, false, 2)
    413 CV_CUDEV_Luv2RGB_INST(Luv4_to_LRGB, 4, 3, false, 2)
    414 CV_CUDEV_Luv2RGB_INST(Luv_to_LRGBA, 3, 4, false, 2)
    415 CV_CUDEV_Luv2RGB_INST(Luv4_to_LRGBA, 4, 4, false, 2)
    416 CV_CUDEV_Luv2RGB_INST(Luv_to_LBGR, 3, 3, false, 0)
    417 CV_CUDEV_Luv2RGB_INST(Luv4_to_LBGR, 4, 3, false, 0)
    418 CV_CUDEV_Luv2RGB_INST(Luv_to_LBGRA, 3, 4, false, 0)
    419 CV_CUDEV_Luv2RGB_INST(Luv4_to_LBGRA, 4, 4, false, 0)
    420 
    421 #undef CV_CUDEV_Luv2RGB_INST
    422 
    423 // 24/32-bit RGB to 16-bit (565 or 555) RGB
    424 
    425 #define CV_CUDEV_RGB2RGB5x5_INST(name, scn, bidx, green_bits) \
    426     typedef cv::cudev::color_cvt_detail::RGB2RGB5x5<scn, bidx, green_bits> name ## _func;
    427 
    428 CV_CUDEV_RGB2RGB5x5_INST(BGR_to_BGR555, 3, 0, 5)
    429 CV_CUDEV_RGB2RGB5x5_INST(BGR_to_BGR565, 3, 0, 6)
    430 CV_CUDEV_RGB2RGB5x5_INST(RGB_to_BGR555, 3, 2, 5)
    431 CV_CUDEV_RGB2RGB5x5_INST(RGB_to_BGR565, 3, 2, 6)
    432 CV_CUDEV_RGB2RGB5x5_INST(BGRA_to_BGR555, 4, 0, 5)
    433 CV_CUDEV_RGB2RGB5x5_INST(BGRA_to_BGR565, 4, 0, 6)
    434 CV_CUDEV_RGB2RGB5x5_INST(RGBA_to_BGR555, 4, 2, 5)
    435 CV_CUDEV_RGB2RGB5x5_INST(RGBA_to_BGR565, 4, 2, 6)
    436 
    437 #undef CV_CUDEV_RGB2RGB5x5_INST
    438 
    439 // 16-bit (565 or 555) RGB to 24/32-bit RGB
    440 
    441 #define CV_CUDEV_RGB5x52RGB_INST(name, dcn, bidx, green_bits) \
    442     typedef cv::cudev::color_cvt_detail::RGB5x52RGB<dcn, bidx, green_bits> name ## _func;
    443 
    444 CV_CUDEV_RGB5x52RGB_INST(BGR555_to_RGB, 3, 2, 5)
    445 CV_CUDEV_RGB5x52RGB_INST(BGR565_to_RGB, 3, 2, 6)
    446 CV_CUDEV_RGB5x52RGB_INST(BGR555_to_BGR, 3, 0, 5)
    447 CV_CUDEV_RGB5x52RGB_INST(BGR565_to_BGR, 3, 0, 6)
    448 CV_CUDEV_RGB5x52RGB_INST(BGR555_to_RGBA, 4, 2, 5)
    449 CV_CUDEV_RGB5x52RGB_INST(BGR565_to_RGBA, 4, 2, 6)
    450 CV_CUDEV_RGB5x52RGB_INST(BGR555_to_BGRA, 4, 0, 5)
    451 CV_CUDEV_RGB5x52RGB_INST(BGR565_to_BGRA, 4, 0, 6)
    452 
    453 #undef CV_CUDEV_RGB5x52RGB_INST
    454 
    455 // Grayscale to 16-bit (565 or 555) RGB
    456 
    457 #define CV_CUDEV_GRAY2RGB5x5_INST(name, green_bits) \
    458     typedef cv::cudev::color_cvt_detail::Gray2RGB5x5<green_bits> name ## _func;
    459 
    460 CV_CUDEV_GRAY2RGB5x5_INST(GRAY_to_BGR555, 5)
    461 CV_CUDEV_GRAY2RGB5x5_INST(GRAY_to_BGR565, 6)
    462 
    463 #undef CV_CUDEV_GRAY2RGB5x5_INST
    464 
    465 // 16-bit (565 or 555) RGB to Grayscale
    466 
    467 #define CV_CUDEV_RGB5x52GRAY_INST(name, green_bits) \
    468     typedef cv::cudev::color_cvt_detail::RGB5x52Gray<green_bits> name ## _func;
    469 
    470 CV_CUDEV_RGB5x52GRAY_INST(BGR555_to_GRAY, 5)
    471 CV_CUDEV_RGB5x52GRAY_INST(BGR565_to_GRAY, 6)
    472 
    473 #undef CV_CUDEV_RGB5x52GRAY_INST
    474 
    475 //! @}
    476 
    477 }}
    478 
    479 #endif
    480