Code covered by the BSD License  

Highlights from
num2jet.m

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.99 KB File ID: #26921

num2jet.m

by David Godlove

 

11 Mar 2010

Returns RGB used in figure output of "image(data)" with default jet colormap selected.

| Watch this File

File Information
Description

I needed to create rgb jpg images of heatmaps that had the same dimensions as my input data. If a heatmap is created using the image function and then saved as a jpgeg, the dimensions of the resulting jpeg no longer correspond to the input dimensions of the data. This function returns a matrix of uint8 data with the same x and y dimensions as the data you input. The z dimension data correspond to RGB values. The output is suitable for conversion to jpg, tiff etc. using imwrite.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
12 Mar 2010 Oliver Woodford

For a more general solution (i.e. that works for any colormap) you can use MATLAB's ind2rgb, or real2rgb (found here: http://www.mathworks.com/matlabcentral/fileexchange/23342).

27 Aug 2010 David Godlove

For a more general solution which retains the original simplicity, see num2colormap.m. This function has been made obsolete by num2colormap.m.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
rgb David Godlove 12 Mar 2010 10:32:05
colormap David Godlove 12 Mar 2010 10:32:05
jet David Godlove 12 Mar 2010 10:32:05
imread David Godlove 12 Mar 2010 10:32:05
image David Godlove 12 Mar 2010 10:32:05
imwrite David Godlove 12 Mar 2010 10:32:06
image processing David Godlove 12 Mar 2010 10:32:06

Contact us at files@mathworks.com