研究生阶段使用过深度数据相当于灰度图grayscalematlab有个imagesc在opencv中没有对应的函数不多说,上代码voidGrayMaptoColo 研究生阶段使用过 深度数据 相当于灰度图 grayscale matlab有个imagesc 在
研究生阶段使用过 深度数据 相当于灰度图 grayscale
matlab有个imagesc
在opencv中 没有对应的函数
不多说,上代码
void GrayMaptoColor(){ const char* imagename = "E:/1.jpg"; //产生灰度图 Mat img = imread(imagename); Mat gray,color; cvtColor(img, gray, CV_RGB2GRAY); //灰度彩色映射变换 double vmin, vmax, alpha; minMaxLoc(gray, alpha = 255.0 / (vmax - vmin); gray.convertTo(gray, CV_8U, alpha, -vmin * alpha); applyColorMap(gray, color, COLORMAP_JET); imshow("image", img); //显示图像 imshow("gray", gray); imshow("color", color); waitKey(); }applyColorMap函数提供多种颜色映射
Class Scale COLORMAP_AUTUMN










