借用其他图像的通道用来彩色
#include <iostream>
#include <opencv2/opencv.hpp>
#include<sstream>
#include<string>
using namespace cv;
using namespace std;
int main()
{
Mat img1 = imread("test6.jpg");
Mat img2 = imread("guise.jpg");
resize(img1, img1, img2.size());
imshow("0", img1);
cvtColor(img2,img2,COLOR_BGR2GRAY);
imshow("1", img2);
vector<Mat> channel;
split(img1,channel);
vector<Mat> channel2;
channel[0].convertTo(channel[0], CV_8UC1);
channel[1].convertTo(channel[1], CV_8UC1);
img2.convertTo(img2, CV_8UC1);
channel2.push_back(channel[0]);
channel2.push_back(channel[1]);
channel2.push_back(img2);
Mat result;
merge(channel2,result);
imshow("2", result);
waitKey(0);
return 0;
}
opencv中伪彩色applyColorMap函数
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
// Mat srcimage = imread("fiveExpereince_test_img.jpg");
Mat hsv;//HSVͼ
Mat src = imread("guise.jpg", 0);
imshow("1", src);
Mat img;
applyColorMap(src,img, COLORMAP_HSV);
imshow("2", img);
waitKey(0);
return 0;
}
利用傅里叶进行伪彩色图像生成
#include <iostream>
#