一、重要函数
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()
{
/