Code covered by the BSD License  

Highlights from
double2rgb

2.0

2.0 | 2 ratings Rate this file 18 Downloads (last 30 days) File Size: 1.78 KB File ID: #30264
image thumbnail

double2rgb

by

 

Converts an array of double (2D or 3D) to an RGB image using specified colormap

| Watch this File

File Information
Description

Computes the min and max values within the input array, convert to 256 values, and apply a colormap to produce a color image (RGB).

It is possible to specifies the range of values to consider, as well as the background color (used for NaN values).

Example:
% Display a default matrix
subplot(1, 2, 1);
imshow(peaks(128), []);
title('as double')
% display the coresponding RGB image
subplot(1, 2, 2); imshow(double2rgb(peaks(128), jet, [-8 8]));
title('as RGB');

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
06 Nov 2011 Sepideh

Great code! I needed to obtain the corresponding color for an array in gray scale and it perfectly worked for me.

06 Nov 2011 Sepideh  
06 Nov 2011 Sepideh  
06 Feb 2011 David Legland

Hi Oliver,

the two features that make this file a little bit different are:
* it works for 2D or 3D images
* it is possible to specify a color for "background", i.e. NaN values.

But I think these options could be easily added to other files you mentioned.

Regards

02 Feb 2011 Oliver Woodford

From the help text it seems like this does exactly the same thing as several other functions available here, e.g. mat2im, real2rgb, etc. What are the benefits?

Contact us