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_EXPR_COLOR_HPP__ 47 #define __OPENCV_CUDEV_EXPR_COLOR_HPP__ 48 49 #include "../common.hpp" 50 #include "../ptr2d/traits.hpp" 51 #include "../ptr2d/transform.hpp" 52 #include "../functional/color_cvt.hpp" 53 #include "expr.hpp" 54 55 namespace cv { namespace cudev { 56 57 //! @addtogroup cudev 58 //! @{ 59 60 #define CV_CUDEV_EXPR_CVTCOLOR_INST(name) \ 61 template <class SrcPtr> \ 62 __host__ Expr<UnaryTransformPtrSz<typename PtrTraits<SrcPtr>::ptr_type, name ## _func<typename VecTraits<typename PtrTraits<SrcPtr>::value_type>::elem_type> > > \ 63 name ## _(const SrcPtr& src) \ 64 { \ 65 return makeExpr(transformPtr(src, name ## _func<typename VecTraits<typename PtrTraits<SrcPtr>::value_type>::elem_type>())); \ 66 } 67 68 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_RGB) 69 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_BGRA) 70 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_RGBA) 71 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_BGR) 72 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_RGB) 73 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_RGBA) 74 75 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_GRAY) 76 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_GRAY) 77 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_GRAY) 78 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_GRAY) 79 80 CV_CUDEV_EXPR_CVTCOLOR_INST(GRAY_to_BGR) 81 CV_CUDEV_EXPR_CVTCOLOR_INST(GRAY_to_BGRA) 82 83 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_YUV) 84 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_YUV) 85 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_YUV4) 86 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_YUV4) 87 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_YUV) 88 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_YUV) 89 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_YUV4) 90 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_YUV4) 91 92 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV_to_RGB) 93 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV_to_RGBA) 94 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV4_to_RGB) 95 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV4_to_RGBA) 96 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV_to_BGR) 97 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV_to_BGRA) 98 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV4_to_BGR) 99 CV_CUDEV_EXPR_CVTCOLOR_INST(YUV4_to_BGRA) 100 101 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_YCrCb) 102 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_YCrCb) 103 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_YCrCb4) 104 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_YCrCb4) 105 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_YCrCb) 106 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_YCrCb) 107 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_YCrCb4) 108 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_YCrCb4) 109 110 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb_to_RGB) 111 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb_to_RGBA) 112 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb4_to_RGB) 113 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb4_to_RGBA) 114 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb_to_BGR) 115 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb_to_BGRA) 116 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb4_to_BGR) 117 CV_CUDEV_EXPR_CVTCOLOR_INST(YCrCb4_to_BGRA) 118 119 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_XYZ) 120 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_XYZ) 121 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_XYZ4) 122 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_XYZ4) 123 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_XYZ) 124 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_XYZ) 125 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_XYZ4) 126 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_XYZ4) 127 128 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ_to_RGB) 129 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ4_to_RGB) 130 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ_to_RGBA) 131 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ4_to_RGBA) 132 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ_to_BGR) 133 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ4_to_BGR) 134 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ_to_BGRA) 135 CV_CUDEV_EXPR_CVTCOLOR_INST(XYZ4_to_BGRA) 136 137 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HSV) 138 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HSV) 139 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HSV4) 140 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HSV4) 141 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HSV) 142 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HSV) 143 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HSV4) 144 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HSV4) 145 146 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HSV_FULL) 147 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HSV_FULL) 148 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HSV4_FULL) 149 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HSV4_FULL) 150 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HSV_FULL) 151 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HSV_FULL) 152 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HSV4_FULL) 153 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HSV4_FULL) 154 155 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_RGB) 156 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_RGBA) 157 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_RGB) 158 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_RGBA) 159 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_BGR) 160 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_BGRA) 161 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_BGR) 162 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_BGRA) 163 164 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_RGB_FULL) 165 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_RGBA_FULL) 166 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_RGB_FULL) 167 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_RGBA_FULL) 168 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_BGR_FULL) 169 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV_to_BGRA_FULL) 170 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_BGR_FULL) 171 CV_CUDEV_EXPR_CVTCOLOR_INST(HSV4_to_BGRA_FULL) 172 173 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HLS) 174 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HLS) 175 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HLS4) 176 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HLS4) 177 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HLS) 178 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HLS) 179 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HLS4) 180 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HLS4) 181 182 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HLS_FULL) 183 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HLS_FULL) 184 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_HLS4_FULL) 185 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_HLS4_FULL) 186 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HLS_FULL) 187 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HLS_FULL) 188 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_HLS4_FULL) 189 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_HLS4_FULL) 190 191 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_RGB) 192 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_RGBA) 193 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_RGB) 194 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_RGBA) 195 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_BGR) 196 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_BGRA) 197 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_BGR) 198 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_BGRA) 199 200 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_RGB_FULL) 201 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_RGBA_FULL) 202 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_RGB_FULL) 203 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_RGBA_FULL) 204 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_BGR_FULL) 205 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS_to_BGRA_FULL) 206 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_BGR_FULL) 207 CV_CUDEV_EXPR_CVTCOLOR_INST(HLS4_to_BGRA_FULL) 208 209 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_Lab) 210 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_Lab) 211 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_Lab4) 212 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_Lab4) 213 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_Lab) 214 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_Lab) 215 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_Lab4) 216 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_Lab4) 217 218 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGB_to_Lab) 219 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGBA_to_Lab) 220 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGB_to_Lab4) 221 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGBA_to_Lab4) 222 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGR_to_Lab) 223 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGRA_to_Lab) 224 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGR_to_Lab4) 225 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGRA_to_Lab4) 226 227 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_RGB) 228 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_RGB) 229 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_RGBA) 230 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_RGBA) 231 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_BGR) 232 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_BGR) 233 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_BGRA) 234 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_BGRA) 235 236 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_LRGB) 237 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_LRGB) 238 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_LRGBA) 239 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_LRGBA) 240 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_LBGR) 241 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_LBGR) 242 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab_to_LBGRA) 243 CV_CUDEV_EXPR_CVTCOLOR_INST(Lab4_to_LBGRA) 244 245 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_Luv) 246 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_Luv) 247 CV_CUDEV_EXPR_CVTCOLOR_INST(RGB_to_Luv4) 248 CV_CUDEV_EXPR_CVTCOLOR_INST(RGBA_to_Luv4) 249 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_Luv) 250 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_Luv) 251 CV_CUDEV_EXPR_CVTCOLOR_INST(BGR_to_Luv4) 252 CV_CUDEV_EXPR_CVTCOLOR_INST(BGRA_to_Luv4) 253 254 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGB_to_Luv) 255 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGBA_to_Luv) 256 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGB_to_Luv4) 257 CV_CUDEV_EXPR_CVTCOLOR_INST(LRGBA_to_Luv4) 258 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGR_to_Luv) 259 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGRA_to_Luv) 260 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGR_to_Luv4) 261 CV_CUDEV_EXPR_CVTCOLOR_INST(LBGRA_to_Luv4) 262 263 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_RGB) 264 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_RGB) 265 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_RGBA) 266 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_RGBA) 267 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_BGR) 268 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_BGR) 269 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_BGRA) 270 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_BGRA) 271 272 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_LRGB) 273 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_LRGB) 274 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_LRGBA) 275 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_LRGBA) 276 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_LBGR) 277 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_LBGR) 278 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv_to_LBGRA) 279 CV_CUDEV_EXPR_CVTCOLOR_INST(Luv4_to_LBGRA) 280 281 #undef CV_CUDEV_EXPR_CVTCOLOR_INST 282 283 //! @} 284 285 }} 286 287 #endif 288