[Index for tmp_for_tar/vrml.doc] [Return to Master Index]

gray2rgb

(tmp_for_tar/vrml.doc/gray2rgb.m)


Function Synopsis

rgb = gray2rgb( gr )

Help text

       rgb = gray2rgb( gr ) - convert graylevel to rgb

 Convert a graylevel pixmap or image structure to rgb

 gr   : H x W   or image structure
 rgb  : H x 3W  or image structure

 Last modified: December 2000



Listing of function file tmp_for_tar/vrml.doc/gray2rgb.m

##       rgb = gray2rgb( gr ) - convert graylevel to rgb
##
## Convert a graylevel pixmap or image structure to rgb
##
## gr   : H x W   or image structure
## rgb  : H x 3W  or image structure

## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
## Last modified: December 2000

function rgb = gray2rgb( gr )
if ! is_struct (gr),
  rgb = kron (gr, [1,1,1]);

else				# Don't convert rgb ims
  if ! gr.rgb,	
    if ! struct_contains(gr,"colormap"),
      rgb.im = gray2rgb (gr.im) ;
    else
      rgb.im = colorize (gr.im, gr.colormap);
    end
  else 
    rgb.im = gr.im ;
  end

  rgb.rgb = 1 ;
  rgb.maxval = gr.maxval;
end

Produced by oct2html on Sat Dec 2 19:08:39 2000
Cross-Directory links are: ON