OpenCV  4.1.0
Open Source Computer Vision
Enumerations | Functions
Color Space Conversions

Enumerations

enum  cv::ColorConversionCodes {
  cv::COLOR_BGR2BGRA = 0,
  cv::COLOR_RGB2RGBA = COLOR_BGR2BGRA,
  cv::COLOR_BGRA2BGR = 1,
  cv::COLOR_RGBA2RGB = COLOR_BGRA2BGR,
  cv::COLOR_BGR2RGBA = 2,
  cv::COLOR_RGB2BGRA = COLOR_BGR2RGBA,
  cv::COLOR_RGBA2BGR = 3,
  cv::COLOR_BGRA2RGB = COLOR_RGBA2BGR,
  cv::COLOR_BGR2RGB = 4,
  cv::COLOR_RGB2BGR = COLOR_BGR2RGB,
  cv::COLOR_BGRA2RGBA = 5,
  cv::COLOR_RGBA2BGRA = COLOR_BGRA2RGBA,
  cv::COLOR_BGR2GRAY = 6,
  cv::COLOR_RGB2GRAY = 7,
  cv::COLOR_GRAY2BGR = 8,
  cv::COLOR_GRAY2RGB = COLOR_GRAY2BGR,
  cv::COLOR_GRAY2BGRA = 9,
  cv::COLOR_GRAY2RGBA = COLOR_GRAY2BGRA,
  cv::COLOR_BGRA2GRAY = 10,
  cv::COLOR_RGBA2GRAY = 11,
  cv::COLOR_BGR2BGR565 = 12,
  cv::COLOR_RGB2BGR565 = 13,
  cv::COLOR_BGR5652BGR = 14,
  cv::COLOR_BGR5652RGB = 15,
  cv::COLOR_BGRA2BGR565 = 16,
  cv::COLOR_RGBA2BGR565 = 17,
  cv::COLOR_BGR5652BGRA = 18,
  cv::COLOR_BGR5652RGBA = 19,
  cv::COLOR_GRAY2BGR565 = 20,
  cv::COLOR_BGR5652GRAY = 21,
  cv::COLOR_BGR2BGR555 = 22,
  cv::COLOR_RGB2BGR555 = 23,
  cv::COLOR_BGR5552BGR = 24,
  cv::COLOR_BGR5552RGB = 25,
  cv::COLOR_BGRA2BGR555 = 26,
  cv::COLOR_RGBA2BGR555 = 27,
  cv::COLOR_BGR5552BGRA = 28,
  cv::COLOR_BGR5552RGBA = 29,
  cv::COLOR_GRAY2BGR555 = 30,
  cv::COLOR_BGR5552GRAY = 31,
  cv::COLOR_BGR2XYZ = 32,
  cv::COLOR_RGB2XYZ = 33,
  cv::COLOR_XYZ2BGR = 34,
  cv::COLOR_XYZ2RGB = 35,
  cv::COLOR_BGR2YCrCb = 36,
  cv::COLOR_RGB2YCrCb = 37,
  cv::COLOR_YCrCb2BGR = 38,
  cv::COLOR_YCrCb2RGB = 39,
  cv::COLOR_BGR2HSV = 40,
  cv::COLOR_RGB2HSV = 41,
  cv::COLOR_BGR2Lab = 44,
  cv::COLOR_RGB2Lab = 45,
  cv::COLOR_BGR2Luv = 50,
  cv::COLOR_RGB2Luv = 51,
  cv::COLOR_BGR2HLS = 52,
  cv::COLOR_RGB2HLS = 53,
  cv::COLOR_HSV2BGR = 54,
  cv::COLOR_HSV2RGB = 55,
  cv::COLOR_Lab2BGR = 56,
  cv::COLOR_Lab2RGB = 57,
  cv::COLOR_Luv2BGR = 58,
  cv::COLOR_Luv2RGB = 59,
  cv::COLOR_HLS2BGR = 60,
  cv::COLOR_HLS2RGB = 61,
  cv::COLOR_BGR2HSV_FULL = 66,
  cv::COLOR_RGB2HSV_FULL = 67,
  cv::COLOR_BGR2HLS_FULL = 68,
  cv::COLOR_RGB2HLS_FULL = 69,
  cv::COLOR_HSV2BGR_FULL = 70,
  cv::COLOR_HSV2RGB_FULL = 71,
  cv::COLOR_HLS2BGR_FULL = 72,
  cv::COLOR_HLS2RGB_FULL = 73,
  cv::COLOR_LBGR2Lab = 74,
  cv::COLOR_LRGB2Lab = 75,
  cv::COLOR_LBGR2Luv = 76,
  cv::COLOR_LRGB2Luv = 77,
  cv::COLOR_Lab2LBGR = 78,
  cv::COLOR_Lab2LRGB = 79,
  cv::COLOR_Luv2LBGR = 80,
  cv::COLOR_Luv2LRGB = 81,
  cv::COLOR_BGR2YUV = 82,
  cv::COLOR_RGB2YUV = 83,
  cv::COLOR_YUV2BGR = 84,
  cv::COLOR_YUV2RGB = 85,
  cv::COLOR_YUV2RGB_NV12 = 90,
  cv::COLOR_YUV2BGR_NV12 = 91,
  cv::COLOR_YUV2RGB_NV21 = 92,
  cv::COLOR_YUV2BGR_NV21 = 93,
  cv::COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21,
  cv::COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21,
  cv::COLOR_YUV2RGBA_NV12 = 94,
  cv::COLOR_YUV2BGRA_NV12 = 95,
  cv::COLOR_YUV2RGBA_NV21 = 96,
  cv::COLOR_YUV2BGRA_NV21 = 97,
  cv::COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
  cv::COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
  cv::COLOR_YUV2RGB_YV12 = 98,
  cv::COLOR_YUV2BGR_YV12 = 99,
  cv::COLOR_YUV2RGB_IYUV = 100,
  cv::COLOR_YUV2BGR_IYUV = 101,
  cv::COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV,
  cv::COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV,
  cv::COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12,
  cv::COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12,
  cv::COLOR_YUV2RGBA_YV12 = 102,
  cv::COLOR_YUV2BGRA_YV12 = 103,
  cv::COLOR_YUV2RGBA_IYUV = 104,
  cv::COLOR_YUV2BGRA_IYUV = 105,
  cv::COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
  cv::COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
  cv::COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12,
  cv::COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12,
  cv::COLOR_YUV2GRAY_420 = 106,
  cv::COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420,
  cv::COLOR_YUV2RGB_UYVY = 107,
  cv::COLOR_YUV2BGR_UYVY = 108,
  cv::COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
  cv::COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
  cv::COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
  cv::COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
  cv::COLOR_YUV2RGBA_UYVY = 111,
  cv::COLOR_YUV2BGRA_UYVY = 112,
  cv::COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
  cv::COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
  cv::COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
  cv::COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
  cv::COLOR_YUV2RGB_YUY2 = 115,
  cv::COLOR_YUV2BGR_YUY2 = 116,
  cv::COLOR_YUV2RGB_YVYU = 117,
  cv::COLOR_YUV2BGR_YVYU = 118,
  cv::COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
  cv::COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
  cv::COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
  cv::COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
  cv::COLOR_YUV2RGBA_YUY2 = 119,
  cv::COLOR_YUV2BGRA_YUY2 = 120,
  cv::COLOR_YUV2RGBA_YVYU = 121,
  cv::COLOR_YUV2BGRA_YVYU = 122,
  cv::COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
  cv::COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
  cv::COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
  cv::COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
  cv::COLOR_YUV2GRAY_UYVY = 123,
  cv::COLOR_YUV2GRAY_YUY2 = 124,
  cv::COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
  cv::COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
  cv::COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
  cv::COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
  cv::COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
  cv::COLOR_RGBA2mRGBA = 125,
  cv::COLOR_mRGBA2RGBA = 126,
  cv::COLOR_RGB2YUV_I420 = 127,
  cv::COLOR_BGR2YUV_I420 = 128,
  cv::COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420,
  cv::COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420,
  cv::COLOR_RGBA2YUV_I420 = 129,
  cv::COLOR_BGRA2YUV_I420 = 130,
  cv::COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420,
  cv::COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420,
  cv::COLOR_RGB2YUV_YV12 = 131,
  cv::COLOR_BGR2YUV_YV12 = 132,
  cv::COLOR_RGBA2YUV_YV12 = 133,
  cv::COLOR_BGRA2YUV_YV12 = 134,
  cv::COLOR_BayerBG2BGR = 46,
  cv::COLOR_BayerGB2BGR = 47,
  cv::COLOR_BayerRG2BGR = 48,
  cv::COLOR_BayerGR2BGR = 49,
  cv::COLOR_BayerBG2RGB = COLOR_BayerRG2BGR,
  cv::COLOR_BayerGB2RGB = COLOR_BayerGR2BGR,
  cv::COLOR_BayerRG2RGB = COLOR_BayerBG2BGR,
  cv::COLOR_BayerGR2RGB = COLOR_BayerGB2BGR,
  cv::COLOR_BayerBG2GRAY = 86,
  cv::COLOR_BayerGB2GRAY = 87,
  cv::COLOR_BayerRG2GRAY = 88,
  cv::COLOR_BayerGR2GRAY = 89,
  cv::COLOR_BayerBG2BGR_VNG = 62,
  cv::COLOR_BayerGB2BGR_VNG = 63,
  cv::COLOR_BayerRG2BGR_VNG = 64,
  cv::COLOR_BayerGR2BGR_VNG = 65,
  cv::COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG,
  cv::COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG,
  cv::COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG,
  cv::COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG,
  cv::COLOR_BayerBG2BGR_EA = 135,
  cv::COLOR_BayerGB2BGR_EA = 136,
  cv::COLOR_BayerRG2BGR_EA = 137,
  cv::COLOR_BayerGR2BGR_EA = 138,
  cv::COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA,
  cv::COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA,
  cv::COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA,
  cv::COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA,
  cv::COLOR_BayerBG2BGRA = 139,
  cv::COLOR_BayerGB2BGRA = 140,
  cv::COLOR_BayerRG2BGRA = 141,
  cv::COLOR_BayerGR2BGRA = 142,
  cv::COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA,
  cv::COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA,
  cv::COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA,
  cv::COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA,
  cv::COLOR_COLORCVT_MAX = 143
}
 

Functions

void cv::cvtColor (InputArray src, OutputArray dst, int code, int dstCn=0)
 Converts an image from one color space to another.
 
void cv::cvtColorTwoPlane (InputArray src1, InputArray src2, OutputArray dst, int code)
 Converts an image from one color space to another where the source image is stored in two planes.
 
void cv::demosaicing (InputArray src, OutputArray dst, int code, int dstCn=0)
 main function for all demosaicing processes
 

Detailed Description

Enumeration Type Documentation

the color conversion codes
See Also
Color conversions
Enumerator
COLOR_BGR2BGRA 

add alpha channel to RGB or BGR image

COLOR_RGB2RGBA 
COLOR_BGRA2BGR 

remove alpha channel from RGB or BGR image

COLOR_RGBA2RGB 
COLOR_BGR2RGBA 

convert between RGB and BGR color spaces (with or without alpha channel)

COLOR_RGB2BGRA 
COLOR_RGBA2BGR 
COLOR_BGRA2RGB 
COLOR_BGR2RGB 
COLOR_RGB2BGR 
COLOR_BGRA2RGBA 
COLOR_RGBA2BGRA 
COLOR_BGR2GRAY 

convert between RGB/BGR and grayscale, color conversions

COLOR_RGB2GRAY 
COLOR_GRAY2BGR 
COLOR_GRAY2RGB 
COLOR_GRAY2BGRA 
COLOR_GRAY2RGBA 
COLOR_BGRA2GRAY 
COLOR_RGBA2GRAY 
COLOR_BGR2BGR565 

convert between RGB/BGR and BGR565 (16-bit images)

COLOR_RGB2BGR565 
COLOR_BGR5652BGR 
COLOR_BGR5652RGB 
COLOR_BGRA2BGR565 
COLOR_RGBA2BGR565 
COLOR_BGR5652BGRA 
COLOR_BGR5652RGBA 
COLOR_GRAY2BGR565 

convert between grayscale to BGR565 (16-bit images)

COLOR_BGR5652GRAY 
COLOR_BGR2BGR555 

convert between RGB/BGR and BGR555 (16-bit images)

COLOR_RGB2BGR555 
COLOR_BGR5552BGR 
COLOR_BGR5552RGB 
COLOR_BGRA2BGR555 
COLOR_RGBA2BGR555 
COLOR_BGR5552BGRA 
COLOR_BGR5552RGBA 
COLOR_GRAY2BGR555 

convert between grayscale and BGR555 (16-bit images)

COLOR_BGR5552GRAY 
COLOR_BGR2XYZ 

convert RGB/BGR to CIE XYZ, color conversions

COLOR_RGB2XYZ 
COLOR_XYZ2BGR 
COLOR_XYZ2RGB 
COLOR_BGR2YCrCb 

convert RGB/BGR to luma-chroma (aka YCC), color conversions

COLOR_RGB2YCrCb 
COLOR_YCrCb2BGR 
COLOR_YCrCb2RGB 
COLOR_BGR2HSV 

convert RGB/BGR to HSV (hue saturation value), color conversions

COLOR_RGB2HSV 
COLOR_BGR2Lab 

convert RGB/BGR to CIE Lab, color conversions

COLOR_RGB2Lab 
COLOR_BGR2Luv 

convert RGB/BGR to CIE Luv, color conversions

COLOR_RGB2Luv 
COLOR_BGR2HLS 

convert RGB/BGR to HLS (hue lightness saturation), color conversions

COLOR_RGB2HLS 
COLOR_HSV2BGR 

backward conversions to RGB/BGR

COLOR_HSV2RGB 
COLOR_Lab2BGR 
COLOR_Lab2RGB 
COLOR_Luv2BGR 
COLOR_Luv2RGB 
COLOR_HLS2BGR 
COLOR_HLS2RGB 
COLOR_BGR2HSV_FULL 
COLOR_RGB2HSV_FULL 
COLOR_BGR2HLS_FULL 
COLOR_RGB2HLS_FULL 
COLOR_HSV2BGR_FULL 
COLOR_HSV2RGB_FULL 
COLOR_HLS2BGR_FULL 
COLOR_HLS2RGB_FULL 
COLOR_LBGR2Lab 
COLOR_LRGB2Lab 
COLOR_LBGR2Luv 
COLOR_LRGB2Luv 
COLOR_Lab2LBGR 
COLOR_Lab2LRGB 
COLOR_Luv2LBGR 
COLOR_Luv2LRGB 
COLOR_BGR2YUV 

convert between RGB/BGR and YUV

COLOR_RGB2YUV 
COLOR_YUV2BGR 
COLOR_YUV2RGB 
COLOR_YUV2RGB_NV12 

YUV 4:2:0 family to RGB.

COLOR_YUV2BGR_NV12 
COLOR_YUV2RGB_NV21 
COLOR_YUV2BGR_NV21 
COLOR_YUV420sp2RGB 
COLOR_YUV420sp2BGR 
COLOR_YUV2RGBA_NV12 
COLOR_YUV2BGRA_NV12 
COLOR_YUV2RGBA_NV21 
COLOR_YUV2BGRA_NV21 
COLOR_YUV420sp2RGBA 
COLOR_YUV420sp2BGRA 
COLOR_YUV2RGB_YV12 
COLOR_YUV2BGR_YV12 
COLOR_YUV2RGB_IYUV 
COLOR_YUV2BGR_IYUV 
COLOR_YUV2RGB_I420 
COLOR_YUV2BGR_I420 
COLOR_YUV420p2RGB 
COLOR_YUV420p2BGR 
COLOR_YUV2RGBA_YV12 
COLOR_YUV2BGRA_YV12 
COLOR_YUV2RGBA_IYUV 
COLOR_YUV2BGRA_IYUV 
COLOR_YUV2RGBA_I420 
COLOR_YUV2BGRA_I420 
COLOR_YUV420p2RGBA 
COLOR_YUV420p2BGRA 
COLOR_YUV2GRAY_420 
COLOR_YUV2GRAY_NV21 
COLOR_YUV2GRAY_NV12 
COLOR_YUV2GRAY_YV12 
COLOR_YUV2GRAY_IYUV 
COLOR_YUV2GRAY_I420 
COLOR_YUV420sp2GRAY 
COLOR_YUV420p2GRAY 
COLOR_YUV2RGB_UYVY 

YUV 4:2:2 family to RGB.

COLOR_YUV2BGR_UYVY 
COLOR_YUV2RGB_Y422 
COLOR_YUV2BGR_Y422 
COLOR_YUV2RGB_UYNV 
COLOR_YUV2BGR_UYNV 
COLOR_YUV2RGBA_UYVY 
COLOR_YUV2BGRA_UYVY 
COLOR_YUV2RGBA_Y422 
COLOR_YUV2BGRA_Y422 
COLOR_YUV2RGBA_UYNV 
COLOR_YUV2BGRA_UYNV 
COLOR_YUV2RGB_YUY2 
COLOR_YUV2BGR_YUY2 
COLOR_YUV2RGB_YVYU 
COLOR_YUV2BGR_YVYU 
COLOR_YUV2RGB_YUYV 
COLOR_YUV2BGR_YUYV 
COLOR_YUV2RGB_YUNV 
COLOR_YUV2BGR_YUNV 
COLOR_YUV2RGBA_YUY2 
COLOR_YUV2BGRA_YUY2 
COLOR_YUV2RGBA_YVYU 
COLOR_YUV2BGRA_YVYU 
COLOR_YUV2RGBA_YUYV 
COLOR_YUV2BGRA_YUYV 
COLOR_YUV2RGBA_YUNV 
COLOR_YUV2BGRA_YUNV 
COLOR_YUV2GRAY_UYVY 
COLOR_YUV2GRAY_YUY2 
COLOR_YUV2GRAY_Y422 
COLOR_YUV2GRAY_UYNV 
COLOR_YUV2GRAY_YVYU 
COLOR_YUV2GRAY_YUYV 
COLOR_YUV2GRAY_YUNV 
COLOR_RGBA2mRGBA 

alpha premultiplication

COLOR_mRGBA2RGBA 
COLOR_RGB2YUV_I420 

RGB to YUV 4:2:0 family.

COLOR_BGR2YUV_I420 
COLOR_RGB2YUV_IYUV 
COLOR_BGR2YUV_IYUV 
COLOR_RGBA2YUV_I420 
COLOR_BGRA2YUV_I420 
COLOR_RGBA2YUV_IYUV 
COLOR_BGRA2YUV_IYUV 
COLOR_RGB2YUV_YV12 
COLOR_BGR2YUV_YV12 
COLOR_RGBA2YUV_YV12 
COLOR_BGRA2YUV_YV12 
COLOR_BayerBG2BGR 

Demosaicing.

COLOR_BayerGB2BGR 
COLOR_BayerRG2BGR 
COLOR_BayerGR2BGR 
COLOR_BayerBG2RGB 
COLOR_BayerGB2RGB 
COLOR_BayerRG2RGB 
COLOR_BayerGR2RGB 
COLOR_BayerBG2GRAY 
COLOR_BayerGB2GRAY 
COLOR_BayerRG2GRAY 
COLOR_BayerGR2GRAY 
COLOR_BayerBG2BGR_VNG 

Demosaicing using Variable Number of Gradients.

COLOR_BayerGB2BGR_VNG 
COLOR_BayerRG2BGR_VNG 
COLOR_BayerGR2BGR_VNG 
COLOR_BayerBG2RGB_VNG 
COLOR_BayerGB2RGB_VNG 
COLOR_BayerRG2RGB_VNG 
COLOR_BayerGR2RGB_VNG 
COLOR_BayerBG2BGR_EA 

Edge-Aware Demosaicing.

COLOR_BayerGB2BGR_EA 
COLOR_BayerRG2BGR_EA 
COLOR_BayerGR2BGR_EA 
COLOR_BayerBG2RGB_EA 
COLOR_BayerGB2RGB_EA 
COLOR_BayerRG2RGB_EA 
COLOR_BayerGR2RGB_EA 
COLOR_BayerBG2BGRA 

Demosaicing with alpha channel.

COLOR_BayerGB2BGRA 
COLOR_BayerRG2BGRA 
COLOR_BayerGR2BGRA 
COLOR_BayerBG2RGBA 
COLOR_BayerGB2RGBA 
COLOR_BayerRG2RGBA 
COLOR_BayerGR2RGBA 
COLOR_COLORCVT_MAX 

Function Documentation

void cv::cvtColor ( InputArray  src,
OutputArray  dst,
int  code,
int  dstCn = 0 
)

Converts an image from one color space to another.

The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.

The conventional ranges for R, G, and B channel values are:

  • 0 to 255 for CV_8U images
  • 0 to 65535 for CV_16U images
  • 0 to 1 for CV_32F images

In case of linear transformations, the range does not matter. But in case of a non-linear transformation, an input RGB image should be normalized to the proper value range to get the correct results, for example, for RGB \(\rightarrow\) L*u*v* transformation. For example, if you have a 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will have the 0..255 value range instead of 0..1 assumed by the function. So, before calling cvtColor , you need first to scale the image down:

img *= 1./255;

If you use cvtColor with 8-bit images, the conversion will have some information lost. For many applications, this will not be noticeable but it is recommended to use 32-bit images in applications that need the full range of colors or that convert an image before an operation and then convert back.

If conversion adds the alpha channel, its value will set to the maximum of corresponding channel range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.

Parameters
srcinput image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision floating-point.
dstoutput image of the same size and depth as src.
codecolor space conversion code (see ColorConversionCodes).
dstCnnumber of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.
See Also
Color conversions
Examples:
samples/cpp/camshiftdemo.cpp, samples/cpp/edge.cpp, samples/cpp/facedetect.cpp, samples/cpp/ffilldemo.cpp, samples/cpp/lkdemo.cpp, samples/cpp/train_HOG.cpp, samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp, samples/cpp/tutorial_code/ImgTrans/houghlines.cpp, samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, samples/cpp/watershed.cpp, samples/dnn/colorization.cpp, and samples/tapi/hog.cpp.
void cv::cvtColorTwoPlane ( InputArray  src1,
InputArray  src2,
OutputArray  dst,
int  code 
)

Converts an image from one color space to another where the source image is stored in two planes.

This function only supports YUV420 to RGB conversion as of now.

Parameters
src1,:8-bit image (CV_8U) of the Y plane.
src2,:image containing interleaved U/V plane.
dst,:output image.
code,:Specifies the type of conversion. It can take any of the following values:
void cv::demosaicing ( InputArray  src,
OutputArray  dst,
int  code,
int  dstCn = 0 
)

main function for all demosaicing processes

Parameters
srcinput image: 8-bit unsigned or 16-bit unsigned.
dstoutput image of the same size and depth as src.
codeColor space conversion code (see the description below).
dstCnnumber of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code.

The function can do the following transformations:

See Also
cvtColor