Saving grayscale image as it appears in jet colormap of imagesc
27 views (last 30 days)
Show older comments
Hello, I have a grayscale TIF images (although it says it is TrueColor, nevermind). I need to convert them to grayscale and save it as it appears in imagesc(), colormap(jet) i.e. color picture.
Matlab code I use:
N = 4
FNAMEFMT = 'Frame%d.tif';
% Load images
for i=1:N
IMAGES = imread(sprintf(FNAMEFMT, i));
IMAGES = rgb2gray(IMAGES);
fname = sprintf('%s\\Frame%d.tif','C:\Project',i);
imagesc(IMAGES); axis image; colorbar; colormap(jet);
imwrite(IMAGES, fname, 'tif');
end
The pictures I import to MATLAB looking like that: http://img845.imageshack.us/img845/531/frame1m.png
But the code I provided saves them again as black/white/gray.
0 Comments
Accepted Answer
More Answers (1)
Georgiy
on 30 Dec 2011
2 Comments
Walter Roberson
on 30 Dec 2011
After you freeze the image, get() the CData property of the image handle; the data returned will be the data to imwrite()
See Also
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!