从灰度转换到RGB colormap

5视图(30天)
你好,我是试图从灰度图像转换为RGB。喷气colormap首先,我试过,但我想这样做对其他可能的colormaps MATLAB。我导入了“car1.jpg”形象,通过这些线转换:
indexedImage = imread (“car1.jpg”);
Gray_Image = indexedImage (:: 1) * 0.299 + indexedImage (:,: 2) * 0.587 + indexedImage (:,:, 3) * 0.114;
然后我给“Gray_Image”变量函数转换RGB“gray_to_jet”。尽管输出似乎“喷气机”,MATLAB喷气colormap之间有差异。我怎么能完全映射值像MATLAB ?我新的图像处理,所以任何帮助包括理论欣赏。这是我的功能:
函数[converted_image, Elapsed_time] = gray_to_jet(变长度输入宗量)
input_image =变长度输入宗量{1};
[row_number, column_number] =大小(input_image);
C = uint8 (255 * colormap (“喷气机”));% 0 - 1数字colormap转换为0 - 255和uint8。
converted_image = 0 (row_number column_number 3);
idx = 1: row_number
jdx = 1: column_number
colormap_row =双(input_image (idx jdx)) + 1;
new_red_pixel = C (colormap_row, 1);
new_green_pixel = C (colormap_row 2);
new_blue_pixel = C (colormap_row 3);
converted_image (idx jdx 1) = new_red_pixel;
converted_image (idx jdx 2) = new_green_pixel;
converted_image (idx jdx 3) = new_blue_pixel;
结束
结束
结束

接受的答案

图像分析
图像分析 2021年4月11日
所以不喜欢。简单地使用ind2rgb ()
rgbImage = ind2rgb (indexedImage,提出);
2的评论
图像分析
图像分析 2021年4月11日
因为它不再是一个MATLAB的问题,你最好问在C语言问答论坛。

登录置评。

更多的答案(0)

类别

找到更多的在橙色帮助中心文件交换

下载188bet金宝搏

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!

翻译的