【问题标题】:MATLAB convertion from grayscale(INTESITY) to truecolor(RGB)MATLAB从灰度(INTENSITY)到真彩色(RGB)的转换
【发布时间】:2012-11-02 19:40:54
【问题描述】:

我知道如何做相反的rgb2gray(img),但我无法找到一个函数gray2rgb(img) 可以从灰度转换为真彩色 em>。

有没有其他功能可以做到这一点?

【问题讨论】:

    标签: matlab colors


    【解决方案1】:

    nice function made by Gabriel Frangakis:

    function [Image]=gray2rgb(Image)
    %Gives a grayscale image an extra dimension
    %in order to use color within it
    [m n]=size(Image);
    rgb=zeros(m,n,3);
    rgb(:,:,1)=Image;
    rgb(:,:,2)=rgb(:,:,1);
    rgb(:,:,3)=rgb(:,:,1);
    Image=rgb/255;
    end
    

    你应该为每个坐标设置灰度值RGB

    【讨论】:

    • 我可以使用 cat: cat(3, img, img, img) '复制'图像吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    • 2014-09-11
    • 2011-12-03
    • 2011-07-10
    相关资源
    最近更新 更多