Image save with colormap

34 Ansichten (letzte 30 Tage)
YongHyun
YongHyun am 10 Mai 2016
Kommentiert: Image Analyst am 11 Mai 2016
Dear all, I have a image data, and I made gray image to color image with jet colormap. However, the imshow function does not support the full scale or full size saving. How can I solve this problem?
  1 Kommentar
Guillaume
Guillaume am 10 Mai 2016
imshow has nothing to do with saving images. I don't understand the question.
Also see this, this, and many more on the jet (rainbow) colour map.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 10 Mai 2016
Bearbeitet: Image Analyst am 10 Mai 2016
When you said "I made gray image to color image with jet colormap" it's not clear if you used
rgbImage = ind2rgb(grayImage, jet(256));
imshow(rgbImage);
Or if you did
imshow(grayImage, []);
colormap(jet(256));
The first snippet creates a new full color RGB image, while the second snippet just displays the gray scale image with a pseudocolor lookup table. Which did you do?
Then you say " imshow function does not support the full scale". Not sure if you mean the size scale or the intensity scale. Anyway, imshow() supports both. The image will be scaled to fit so that the whole image will fit into whatever size the axes control is.
Then you say "the imshow function does not support the full ... size saving". You don't use imshow() to save the image, you use imwrite(), and imwrite() will save the full sized image.
If you want to display the full size image, you'll need to use a imscrollpanel. See attached demo from the Mathworks.
  2 Kommentare
YongHyun
YongHyun am 11 Mai 2016
I mean the image size, because imshow and save does not support full size image saving. Also, the image data have over the 8 bit. e.g)
imshow(image,[300 330],'colormap',jet)
after that, I want to save the showed image as full size. Thanks in advance.
Image Analyst
Image Analyst am 11 Mai 2016
Again, imshow() does not save - it displays, and it displays the full sized image in the axes. The save() function, just like the imwrite() function, will also save the full sized image to a .mat file, if that's what you do. The saved image will remain the same class, like uint8.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Amy Haskins
Amy Haskins am 10 Mai 2016
You're using your gray image like an indexed image and applying a colormap. The function ind2rgb will let you convert your gray image to RGB with a specified colormap and give you the full res image you're looking for.
If by save you mean save to disk, then you can use imwrite with the syntax imwrite(A,map,filename) to save the gray image and colormap, or you can save the RGB image with the imwite(A,filename) syntax after calling ind2rgb.

Walter Roberson
Walter Roberson am 10 Mai 2016
Get freezeColors from the File Exchange. Display your image. freeze the colors. get the CData property from the image object. imwrite() it to a file.

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by