Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说
opencv cvfindcontours_opencv常用函数集合,希望能够帮助你!!!。
opencv使用cvtColor()函数对图像进行色彩空间的转换。
C++ API如下表所示:
void cv::cvtColor | ( | InputArray | src, | (原始图像,格式:8-bit unsigned / 16-bit unsigned / single-precision floating-point) |
---|---|---|---|---|
OutputArray | dst, | (目标图像:size与depth和原始图像要相等) | ||
int | code, | (色彩空间转换码)(ColorConversionCodes) | ||
int | dstCn=0 |
(目标图像的通道数,此参数为0时,目标图像的通道数由原始图像自动生成) | ||
) |
python API如下表所示:
dst | = | cv.cvtColor( | src, code[, dst[, dstCn]] | ) |
---|
R,G,和B分量的取值范围一般如下:
如果对8-bit images使用cvtColor()函数,转换会丢失部分信息,一般不明显。推荐先将图像转换成32-bit images,再进行色彩空间转换,最后再把图像转换成8-bit images。
Color conversions
camshiftdemo.cpp
ffilldemo.cpp, hog.cpp
houghcircles.cpp
houghlines.cpp
lkdemo.cpp
Sobel_Demo.cpp
train_HOG.cpp
watershed.cpp.
转换代码 | 转换说明 |
---|---|
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 colorspaces(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_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 and 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 CIEXYZ,官网代码样例 |
COLOR_RGB2XYZ | |
COLOR_XYZ2BGR | |
COLOR_XYZ2RGB | |
COLOR_BGR2YCrCb | convert RGB/BGR to luma-chroma(akaYCC),官网代码样例 |
COLOR_RGB2YCrCb | |
COLOR_YCrCb2BGR | |
COLOR_YCrCb2RGB | |
COLOR_BGR2HSV | convert RGB/BGR to HSV(hue saturation value),官网代码样例 |
COLOR_RGB2HSV | |
COLOR_BGR2Lab | convert RGB/BGR to CIELab,官网代码样例 |
COLOR_RGB2Lab | |
COLOR_BGR2Luv | convert RGB/BGR to CIELuv,官网代码样例 |
COLOR_RGB2Luv | |
COLOR_BGR2HLS | convert RGB/BGR to HLS(hue lightness saturation),官网代码样例 |
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 | YUV4: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 | YUV4: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 YUV4: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 Numberof 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 |
今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
上一篇
已是最后文章
下一篇
已是最新文章