Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This code i use colormap , you can marker ones channels I think it can work.

Mat temp;
Mat M1=Mat(256,1,CV_8U);
Mat M2=Mat(256,1,CV_8U);
Mat M3=Mat(256,1,CV_8U);
cv::cvtColor(src,temp,CV_BGR2GRAY);
Mat r1,r2,r3;

cv::LUT(temp,M1,r1);
cv::LUT(temp,M2,r2);
cv::LUT(temp,M3,r3);
std::vector<cv::Mat> planes;
planes.push_back(r1);
planes.push_back(r2);
planes.push_back(r3);

cv::merge(planes,dst);

This code i use colormap , you can marker ones channels channels or one channel remain the same. I think it can work.

Mat temp;
Mat M1=Mat(256,1,CV_8U);
Mat M2=Mat(256,1,CV_8U);
Mat M3=Mat(256,1,CV_8U);
cv::cvtColor(src,temp,CV_BGR2GRAY);
Mat r1,r2,r3;

cv::LUT(temp,M1,r1);
cv::LUT(temp,M2,r2);
cv::LUT(temp,M3,r3);
std::vector<cv::Mat> planes;
planes.push_back(r1);
planes.push_back(r2);
planes.push_back(r3);

cv::merge(planes,dst);