// splitAndmerge.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
vector<Mat> channels;
Mat imageBlueChannel;
Mat imageGreenChannel;
Mat imageRedChannel;
Mat Image=imread("E://2.png");
Mat DstImage;
Mat dst;
split(Image,channels);
imageBlueChannel=channels.at(0);
imageGreenChannel=channels.at(1);
imageRedChannel=channels.at(2);
addWeighted(imageBlueChannel,1,imageGreenChannel,1,0,dst);
//imshow("B+G",dst);
//imshow("imageBlueChannel",imageBlueChannel);
//Lab颜色空间
vector<Mat> channel;
cvtColor(Image,DstImage,CV_BGR2Lab);
split(DstImage,channel);
Mat imageLchannel=channel.at(0);
Mat imageAchannel=channel.at(1);//a
Mat imageBchannel=channel.at(2);//b
addWeighted(imageAchannel,1,imageBchannel,1,0,dst);
imshow("orginal",DstImage);
//imshow("L",imageLchannel);
//imshow("A",imageAchannel);
//imshow("B",imageBchannel);
imshow("A+B",dst);
//merge()
waitKey(0);
}
//
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
vector<Mat> channels;
Mat imageBlueChannel;
Mat imageGreenChannel;
Mat imageRedChannel;
Mat Image=imread("E://2.png");
Mat DstImage;
Mat dst;
split(Image,channels);
imageBlueChannel=channels.at(0);
imageGreenChannel=channels.at(1);
imageRedChannel=channels.at(2);
addWeighted(imageBlueChannel,1,imageGreenChannel,1,0,dst);
//imshow("B+G",dst);
//imshow("imageBlueChannel",imageBlueChannel);
//Lab颜色空间
vector<Mat> channel;
cvtColor(Image,DstImage,CV_BGR2Lab);
split(DstImage,channel);
Mat imageLchannel=channel.at(0);
Mat imageAchannel=channel.at(1);//a
Mat imageBchannel=channel.at(2);//b
addWeighted(imageAchannel,1,imageBchannel,1,0,dst);
imshow("orginal",DstImage);
//imshow("L",imageLchannel);
//imshow("A",imageAchannel);
//imshow("B",imageBchannel);
imshow("A+B",dst);
//merge()
waitKey(0);
}