gray2rgb.m

来自「histogram based code for image retrival」· M 代码 · 共 37 行

M
37
字号
function [out] = gray2rgb(I)
%
% |----------------------------------------------------------|
% | Hybrid Texture Synthesis MATLAB package                  |
% |                                                          |
% | Author: Andrew Nealen                                    |
% |         Discrete Geometric Modeling Group                |
% |         Technische Universitaet Darmstadt, Germany       |
% |                                                          |
% | Note:   This is part of the prototype implementation     |
% |         accompanying our paper/my thesis                 |
% |                                                          |
% |         Hybrid Texture Synthesis. A. Nealen and M. Alexa |
% |         Eurographics Symposium on Rendering 2003         |
% |                                                          |
% |         Hybrid Texture Synthesis. A. Nealen              |
% |         Diplomarbeit (MSc), TU Darmstadt, 2003           |
% |                                                          |
% |         See the paper/thesis for further details.        |
% |----------------------------------------------------------|
%
% GRAY2RGB simply transfer grayscale image into rgb mode, if
%          the image is not already rgb
%
%   [out] = gray2rgb(I)
%

out = I;
if (length(size(I)) > 2), return; end 

out = zeros(size(I,1), size(I,2), 3);
for j=1:size(I,1),
    for i=1:size(I,2),
        out(j,i,1:3) = I(j,i);
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?