从灰度转换到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;
结束
结束
结束