与之前的采用图像指针进行读取的图像的三原色通道相比,本文采用两个函数进行,一个是分通道函数,一个是通道组合,但是由于本人刚入门,只能读取三个通道后通过灰度显示,彩色显示时,其他两个通道填充0时出现问题,目前还在思考中,如果有盆友能够解答自是万分感谢!疑问:如何将蓝色、绿色以及红色通道分别赋予三个图像的对应通道,并且将其他两个通道置零?
#include<opencv2/opencv.hpp>
#include<iostream>
#include<cassert>
#include<vector>
using namespace cv;
using namespace std;
int main()
{
Mat srcImage = imread("D:/Visual Studio 2015/lena.bmp");
Mat imageBlue, imageGreen, imageRed;
Mat mergeImage;
//Mat r[512][512] , g[512][512], b[512][512];
//r = imageBlue(Rect(0, 0, imageBlue.cols, imageBlue.rows));
//g = imageBlue