OpenCV实现RGB、HSV通道的分离与合并

本文介绍了如何利用OpenCV库进行RGB和HSV颜色通道的分离及合并。重点讲解了split函数用于图像通道的分割,以及merge函数用于将通道重新组合。示例中详细展示了RGB通道的分离,并特别指出HSV通道的分离处理方式。文章最后给出了运行结果。
摘要由CSDN通过智能技术生成

一、重要函数

split:把一个彩色图像分割成3个通道

merge:split的反操作

/** @overload
@param m input multi-channel array.
@param mv output vector of arrays; the arrays themselves are reallocated, if needed.
*/

CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);

/** @overload
@param mv input vector of matrices to be merged; all the matrices in mv must have the same
size and the same depth.
@param dst output array of the same size and the same depth as mv[0]; The number of channels will
be the total number of channels in the matrix array.
  */
CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);

二、示例代码

RGB分离

#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
Mat srcImage1, dstImage1, dstImage2;
String imagePath = "C:/Users/admin/Pictures/1.2.png";
int main()
{
	/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值