OpenCV基础知识
色彩空间 RGB与BGR
- RGB:人眼的色彩空间
- OpenCV默认使用BGR
HSV与HSL
-
HSV
- Hue:色相,即色彩,如红色,蓝色
- Saturation:饱和度,颜色的纯度
- Value:明度
-
HSL
- Hue:色相
- Saturation:饱和度
- Lightness:亮度
OpenCV为什么要使用HSV
OpenCV可以针对颜色的色相进行判断,RGB不好判断。
OpenCV色彩空间转换
- YUV 主要用在视频中,编解码器一般都会使用yvu作为数据源。对于yvu来说主要包括三种类型
- YUV4:2:0
- YUV4:2:2
- YUV4:4:4
注意
以上都是对于像素的描述,例如 YUV4:4:4
代表4个Y数据,4个U数据,4个V数据。Y代表灰色的录像,UV代表颜色。比如以前家用的黑白电视,黑白电视用的就是数据 Y,有了彩色电视,兼容黑白电视就有了YUV。这样彩色电视即可以播放黑白画面,也可以播放彩色画面。YUV4:4:4
类似RGB,RGB是8:8:8
8个红色 8个绿色 8个蓝色。
YUV4:2:0
是一个标准,它比 YUV4:4:4
存储空间节省一半。我们的音视频编解码器都是以这个为标准的。
- OpenCV色彩空间转换支持的转换方式1
- 范例
import cv2 def callback(userdata): pass cv2.namedWindow('color', cv2.WINDOW_NORMAL) img = cv2.imread('./RMB.jpeg') colorspaces = [cv2.COLOR_BGR2RGBA, cv2.COLOR_BGR2BGRA, cv2.COLOR_BGR2GRAY, cv2.COLOR_BGR2HSV, cv2.COLOR_BGR2YUV] cv2.createTrackbar('curcolor', 'color', 0, len(colorspaces), callback) while True: index = cv2.getTrackbarPos('curcolor', 'color') #颜色空间转换API cvt_img = cv2.cvtColor(img, colorspaces[index]) cv2.imshow('color', cvt_img) key = cv2.waitKey(10) print(key) if key & 0xFF == ord('q'): break cv2.destroyAllWindows()
Numpy基本操作
Numpy
OpenCV中用到的矩阵都需要转换成Numpy
Numpy是一个经高度优化的Python数值库
- 创建矩阵:图形的处理就是矩阵的处理
- 检索与赋值[y, x]:获取矩阵中某个元素的值,并且可以改变这个元素的值
- 获取子数组[:, :]:获取大的矩阵中的某一小块矩阵,或者给某一小块矩阵赋值
Numpy创建矩阵
- 创建数组
- 创建全0数组 zeros()/ones:全部是0 或 1
- 创建全值数组 full():比如创建一个8x8的矩阵,矩阵中的值都是指定的值,比如100 每个元素都是100
- 创建单元数组 identity/eye():简称为单元矩阵或单位矩阵,单位矩阵表示斜角都是1的 两边都是0的就叫单位矩阵,单位矩阵一般是正方形的(3x3 4x4 8x8等),eye是非正方形的矩阵(3x5 9x20等)
array
- np.array([2, 3, 4])
- np.array([[1.0, 2.0],[3.0, 4.0]])
zeros
- np.zeros((480, 640, 3), np.uint8)
- (480, 640, 3): (行的个数 高度, 列的个数 宽度, 通道数/层数 n层)
- np.uint8: 矩阵中的类型
ones
- 同zeros
full
-
np.full((480, 640, 3), 255, np.uint8)
- (480, 640, 3): (行的个数 高度, 列的个数 宽度, 通道数/层数 n层)
- 255: 表示每个元素的数值
- np.uint8: 矩阵中的类型
# 定义full矩阵 e = np.full((4, 4), 8, np.uint8) print(e) ''' 输出 [[8 8 8 8] [8 8 8 8] [8 8 8 8] [8 8 8 8]] '''
identity
- np.identity(n): 斜对角是1, 其余是0
- n 为 n x n 的矩阵
eye
- np.eye((x, y), k=z):可以是非正方形
- x: 高
- y: 宽
- z: 斜对角偏移个数
Numpy - 矩阵的检索与赋值
-
矩阵检索与赋值
- [y, x]
- 通过下标检索,y在前面 x在后面
- 检索矩阵的索引值从0开始,如比我们检索5,3 实际访问的却是6,4
- [y, x, channel]
- 对于RGB或BGR来说,一般是含有多通道的,所以在表示的时候就是 Y X 通道数/层数 (也可以认为成x y z)。
img = np.zeros((480, 640, 3), np.uint8) #从矩阵中读某个元素的值 print(img[100, 100]) count = 0 #向矩阵中某个元素赋值 while count < 200: #BGR img[count, 100] = [255, 255, 255] count = count + 1 cv2.imshow('img', img) key = cv2.waitKey(0) if key & 0xFF == ord('q'): cv2.destroyAllWindows()
Numpy - ROI
- [y, x]
-
获取子矩阵 ROI: Region of Image(图像中的某一块区域)
- [[y1, y2],[x1, x2]]: 局部获取及变更
- [:, :] : 所有图像获取及变更
img = np.zeros((480, 640, 3), np.uint8) #从矩阵中读某个元素的值 print(img[100, 100]) count = 0 #向矩阵中某个元素赋值 while count < 200: #BGR img[count, 100] = [255, 255, 255] count = count + 1 roi = img[100:400, 100:600] #roi[:,:] = [0,0,255] roi[:] = [0,0,255] roi[:,10] = [0, 0, 0] roi[10:200,10:200] = [0,255,0] cv2.imshow('img', roi) key = cv2.waitKey(0) if key & 0xFF == ord('q'): cv2.destroyAllWindows()
OpenCV的重要结构体Mat
- Mat是矩阵,如果是黑白色即只有1个通道,如果是彩色即有3个通道
- Mat的好处是使用Numpy直接可以用矩阵的方式进行访问,操作方便
- Mat的结构
- Header:存放了一些属性,属性包括
dims
维数、rows
行、cols
列数、*data
指针(存储数据的指针,头指向某一个data)、*refcount
引用计数/修改(防止内存泄露,引用修改方式)。 - Data:存储数据部分,图像的颜色
- Header:存放了一些属性,属性包括
- Mat的结构
Mat的深拷贝与浅拷贝
import cv2
img = cv2.imread('./RMB.jpeg')
# 浅拷贝
img2 = img
# 深拷贝
img3 = img.copy()
img[100: 200, 100: 200] = [0, 0, 255]
cv2.imshow('img', img)
cv2.imshow('img2', img2)
cv2.imshow('img3', img3)
cv2.waitKey(0)
图像的多种属性
- 访问图像mat的属性
通道的分割与合并
- split(mat)
- merge((ch1, ch2, ...))
扩展信息
- COLOR_BGRA2BGR = 1, //!< remove alpha channel from RGB or BGR image
-
COLOR_RGBA2RGB = COLOR_BGRA2BGR,
-
COLOR_BGR2RGBA = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel)
-
COLOR_RGB2BGRA = COLOR_BGR2RGBA,
-
COLOR_RGBA2BGR = 3,
-
COLOR_BGRA2RGB = COLOR_RGBA2BGR,
-
COLOR_BGR2RGB = 4,
-
COLOR_RGB2BGR = COLOR_BGR2RGB,
-
COLOR_BGRA2RGBA = 5,
-
COLOR_RGBA2BGRA = COLOR_BGRA2RGBA,
-
COLOR_BGR2GRAY = 6, //!< convert between RGB/BGR and grayscale, @ref color_convert_rgb_gray "color conversions"
- COLOR_RGB2GRAY = 7,
- COLOR_GRAY2BGR = 8,
- COLOR_GRAY2RGB = COLOR_GRAY2BGR,
- COLOR_GRAY2BGRA = 9,
- COLOR_GRAY2RGBA = COLOR_GRAY2BGRA,
- COLOR_BGRA2GRAY = 10,
-
COLOR_RGBA2GRAY = 11,
-
COLOR_BGR2BGR565 = 12, //!< convert between RGB/BGR and BGR565 (16-bit images)
- COLOR_RGB2BGR565 = 13,
- COLOR_BGR5652BGR = 14,
- COLOR_BGR5652RGB = 15,
- COLOR_BGRA2BGR565 = 16,
- COLOR_RGBA2BGR565 = 17,
- COLOR_BGR5652BGRA = 18,
-
COLOR_BGR5652RGBA = 19,
-
COLOR_GRAY2BGR565 = 20, //!< convert between grayscale to BGR565 (16-bit images)
-
COLOR_BGR5652GRAY = 21,
-
COLOR_BGR2BGR555 = 22, //!< convert between RGB/BGR and BGR555 (16-bit images)
- COLOR_RGB2BGR555 = 23,
- COLOR_BGR5552BGR = 24,
- COLOR_BGR5552RGB = 25,
- COLOR_BGRA2BGR555 = 26,
- COLOR_RGBA2BGR555 = 27,
- COLOR_BGR5552BGRA = 28,
-
COLOR_BGR5552RGBA = 29,
-
COLOR_GRAY2BGR555 = 30, //!< convert between grayscale and BGR555 (16-bit images)
-
COLOR_BGR5552GRAY = 31,
-
COLOR_BGR2XYZ = 32, //!< convert RGB/BGR to CIE XYZ, @ref color_convert_rgb_xyz "color conversions"
- COLOR_RGB2XYZ = 33,
- COLOR_XYZ2BGR = 34,
-
COLOR_XYZ2RGB = 35,
-
COLOR_BGR2YCrCb = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref color_convert_rgb_ycrcb "color conversions"
- COLOR_RGB2YCrCb = 37,
- COLOR_YCrCb2BGR = 38,
-
COLOR_YCrCb2RGB = 39,
-
COLOR_BGR2HSV = 40, //!< convert RGB/BGR to HSV (hue saturation value) with H range 0..180 if 8 bit image, @ref color_convert_rgb_hsv "color conversions"
-
COLOR_RGB2HSV = 41,
-
COLOR_BGR2Lab = 44, //!< convert RGB/BGR to CIE Lab, @ref color_convert_rgb_lab "color conversions"
-
COLOR_RGB2Lab = 45,
-
COLOR_BGR2Luv = 50, //!< convert RGB/BGR to CIE Luv, @ref color_convert_rgb_luv "color conversions"
- COLOR_RGB2Luv = 51,
- COLOR_BGR2HLS = 52, //!< convert RGB/BGR to HLS (hue lightness saturation) with H range 0..180 if 8 bit image, @ref color_convert_rgb_hls "color conversions"
-
COLOR_RGB2HLS = 53,
-
COLOR_HSV2BGR = 54, //!< backward conversions HSV to RGB/BGR with H range 0..180 if 8 bit image
-
COLOR_HSV2RGB = 55,
-
COLOR_Lab2BGR = 56,
- COLOR_Lab2RGB = 57,
- COLOR_Luv2BGR = 58,
- COLOR_Luv2RGB = 59,
- COLOR_HLS2BGR = 60, //!< backward conversions HLS to RGB/BGR with H range 0..180 if 8 bit image
-
COLOR_HLS2RGB = 61,
-
COLOR_BGR2HSV_FULL = 66, //!< convert RGB/BGR to HSV (hue saturation value) with H range 0..255 if 8 bit image, @ref color_convert_rgb_hsv "color conversions"
- COLOR_RGB2HSV_FULL = 67,
- COLOR_BGR2HLS_FULL = 68, //!< convert RGB/BGR to HLS (hue lightness saturation) with H range 0..255 if 8 bit image, @ref color_convert_rgb_hls "color conversions"
-
COLOR_RGB2HLS_FULL = 69,
-
COLOR_HSV2BGR_FULL = 70, //!< backward conversions HSV to RGB/BGR with H range 0..255 if 8 bit image
- COLOR_HSV2RGB_FULL = 71,
- COLOR_HLS2BGR_FULL = 72, //!< backward conversions HLS to RGB/BGR with H range 0..255 if 8 bit image
-
COLOR_HLS2RGB_FULL = 73,
-
COLOR_LBGR2Lab = 74,
- COLOR_LRGB2Lab = 75,
- COLOR_LBGR2Luv = 76,
-
COLOR_LRGB2Luv = 77,
-
COLOR_Lab2LBGR = 78,
- COLOR_Lab2LRGB = 79,
- COLOR_Luv2LBGR = 80,
-
COLOR_Luv2LRGB = 81,
-
COLOR_BGR2YUV = 82, //!< convert between RGB/BGR and YUV
- COLOR_RGB2YUV = 83,
- COLOR_YUV2BGR = 84,
- COLOR_YUV2RGB = 85,
//! YUV 4:2:0 family to RGB
- COLOR_YUV2RGB_NV12 = 90,
- COLOR_YUV2BGR_NV12 = 91,
- COLOR_YUV2RGB_NV21 = 92,
- COLOR_YUV2BGR_NV21 = 93,
- COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21,
- COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21,
- COLOR_YUV2RGBA_NV12 = 94,
- COLOR_YUV2BGRA_NV12 = 95,
- COLOR_YUV2RGBA_NV21 = 96,
- COLOR_YUV2BGRA_NV21 = 97,
- COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
-
COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
-
COLOR_YUV2RGB_YV12 = 98,
- COLOR_YUV2BGR_YV12 = 99,
- COLOR_YUV2RGB_IYUV = 100,
- COLOR_YUV2BGR_IYUV = 101,
- COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV,
- COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV,
- COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12,
-
COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12,
-
COLOR_YUV2RGBA_YV12 = 102,
- COLOR_YUV2BGRA_YV12 = 103,
- COLOR_YUV2RGBA_IYUV = 104,
- COLOR_YUV2BGRA_IYUV = 105,
- COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
- COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
- COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12,
-
COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12,
-
COLOR_YUV2GRAY_420 = 106,
- COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
- COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
- COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
- COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
- COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
- COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
-
COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420,
//! YUV 4:2:2 family to RGB
- COLOR_YUV2RGB_UYVY = 107,
- COLOR_YUV2BGR_UYVY = 108,
//COLOR_YUV2RGB_VYUY = 109,
//COLOR_YUV2BGR_VYUY = 110,
- COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
- COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
- COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
- COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY, -
COLOR_YUV2RGBA_UYVY = 111,
- COLOR_YUV2BGRA_UYVY = 112,
//COLOR_YUV2RGBA_VYUY = 113,
//COLOR_YUV2BGRA_VYUY = 114, - COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
- COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
- COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
-
COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
-
COLOR_YUV2RGB_YUY2 = 115,
- COLOR_YUV2BGR_YUY2 = 116,
- COLOR_YUV2RGB_YVYU = 117,
- COLOR_YUV2BGR_YVYU = 118,
- COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
- COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
- COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
-
COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
-
COLOR_YUV2RGBA_YUY2 = 119,
- COLOR_YUV2BGRA_YUY2 = 120,
- COLOR_YUV2RGBA_YVYU = 121,
- COLOR_YUV2BGRA_YVYU = 122,
- COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
- COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
- COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
-
COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
-
COLOR_YUV2GRAY_UYVY = 123,
- COLOR_YUV2GRAY_YUY2 = 124,
//CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, - COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
- COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
- COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
- COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
- COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
//! alpha premultiplication
- COLOR_RGBA2mRGBA = 125,
- COLOR_mRGBA2RGBA = 126,
//! RGB to YUV 4:2:0 family
- COLOR_RGB2YUV_I420 = 127,
- COLOR_BGR2YUV_I420 = 128,
- COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420,
- COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420,
- COLOR_RGBA2YUV_I420 = 129,
- COLOR_BGRA2YUV_I420 = 130,
- COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420,
- COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420,
- COLOR_RGB2YUV_YV12 = 131,
- COLOR_BGR2YUV_YV12 = 132,
- COLOR_RGBA2YUV_YV12 = 133,
- COLOR_BGRA2YUV_YV12 = 134,
//! Demosaicing, see @ref color_convert_bayer "color conversions" for additional information
- COLOR_BayerBG2BGR = 46, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2BGR = 47, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2BGR = 48, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2BGR = 49, //!< equivalent to GBRG Bayer pattern
- COLOR_BayerRGGB2BGR = COLOR_BayerBG2BGR,
- COLOR_BayerGRBG2BGR = COLOR_BayerGB2BGR,
- COLOR_BayerBGGR2BGR = COLOR_BayerRG2BGR,
-
COLOR_BayerGBRG2BGR = COLOR_BayerGR2BGR,
-
COLOR_BayerRGGB2RGB = COLOR_BayerBGGR2BGR,
- COLOR_BayerGRBG2RGB = COLOR_BayerGBRG2BGR,
- COLOR_BayerBGGR2RGB = COLOR_BayerRGGB2BGR,
-
COLOR_BayerGBRG2RGB = COLOR_BayerGRBG2BGR,
-
COLOR_BayerBG2RGB = COLOR_BayerRG2BGR, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2RGB = COLOR_BayerGR2BGR, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2RGB = COLOR_BayerBG2BGR, //!< equivalent to BGGR Bayer pattern
-
COLOR_BayerGR2RGB = COLOR_BayerGB2BGR, //!< equivalent to GBRG Bayer pattern
-
COLOR_BayerBG2GRAY = 86, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2GRAY = 87, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2GRAY = 88, //!< equivalent to BGGR Bayer pattern
-
COLOR_BayerGR2GRAY = 89, //!< equivalent to GBRG Bayer pattern
-
COLOR_BayerRGGB2GRAY = COLOR_BayerBG2GRAY,
- COLOR_BayerGRBG2GRAY = COLOR_BayerGB2GRAY,
- COLOR_BayerBGGR2GRAY = COLOR_BayerRG2GRAY,
- COLOR_BayerGBRG2GRAY = COLOR_BayerGR2GRAY,
//! Demosaicing using Variable Number of Gradients
- COLOR_BayerBG2BGR_VNG = 62, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2BGR_VNG = 63, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2BGR_VNG = 64, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2BGR_VNG = 65, //!< equivalent to GBRG Bayer pattern
- COLOR_BayerRGGB2BGR_VNG = COLOR_BayerBG2BGR_VNG,
- COLOR_BayerGRBG2BGR_VNG = COLOR_BayerGB2BGR_VNG,
- COLOR_BayerBGGR2BGR_VNG = COLOR_BayerRG2BGR_VNG,
-
COLOR_BayerGBRG2BGR_VNG = COLOR_BayerGR2BGR_VNG,
-
COLOR_BayerRGGB2RGB_VNG = COLOR_BayerBGGR2BGR_VNG,
- COLOR_BayerGRBG2RGB_VNG = COLOR_BayerGBRG2BGR_VNG,
- COLOR_BayerBGGR2RGB_VNG = COLOR_BayerRGGB2BGR_VNG,
-
COLOR_BayerGBRG2RGB_VNG = COLOR_BayerGRBG2BGR_VNG,
-
COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG, //!< equivalent to GBRG Bayer pattern
//! Edge-Aware Demosaicing
- COLOR_BayerBG2BGR_EA = 135, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2BGR_EA = 136, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2BGR_EA = 137, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2BGR_EA = 138, //!< equivalent to GBRG Bayer pattern
- COLOR_BayerRGGB2BGR_EA = COLOR_BayerBG2BGR_EA,
- COLOR_BayerGRBG2BGR_EA = COLOR_BayerGB2BGR_EA,
- COLOR_BayerBGGR2BGR_EA = COLOR_BayerRG2BGR_EA,
-
COLOR_BayerGBRG2BGR_EA = COLOR_BayerGR2BGR_EA,
-
COLOR_BayerRGGB2RGB_EA = COLOR_BayerBGGR2BGR_EA,
- COLOR_BayerGRBG2RGB_EA = COLOR_BayerGBRG2BGR_EA,
- COLOR_BayerBGGR2RGB_EA = COLOR_BayerRGGB2BGR_EA,
-
COLOR_BayerGBRG2RGB_EA = COLOR_BayerGRBG2BGR_EA,
-
COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA, //!< equivalent to GBRG Bayer pattern
//! Demosaicing with alpha channel
- COLOR_BayerBG2BGRA = 139, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2BGRA = 140, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2BGRA = 141, //!< equivalent to BGGR Bayer pattern
- COLOR_BayerGR2BGRA = 142, //!< equivalent to GBRG Bayer pattern
- COLOR_BayerRGGB2BGRA = COLOR_BayerBG2BGRA,
- COLOR_BayerGRBG2BGRA = COLOR_BayerGB2BGRA,
- COLOR_BayerBGGR2BGRA = COLOR_BayerRG2BGRA,
-
COLOR_BayerGBRG2BGRA = COLOR_BayerGR2BGRA,
-
COLOR_BayerRGGB2RGBA = COLOR_BayerBGGR2BGRA,
- COLOR_BayerGRBG2RGBA = COLOR_BayerGBRG2BGRA,
- COLOR_BayerBGGR2RGBA = COLOR_BayerRGGB2BGRA,
-
COLOR_BayerGBRG2RGBA = COLOR_BayerGRBG2BGRA,
-
COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA, //!< equivalent to RGGB Bayer pattern
- COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA, //!< equivalent to GRBG Bayer pattern
- COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA, //!< equivalent to BGGR Bayer pattern
-
COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA, //!< equivalent to GBRG Bayer pattern
-
COLOR_COLORCVT_MAX = 143
-
如下
- COLOR_BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image
- COLOR_RGB2RGBA = COLOR_BGR2BGRA,
↩