Use a different colormap for two images

4 views (last 30 days)
Gökçen
Gökçen on 11 May 2011
Hi! I have two different images which I want to display on top of each other. I want to use two different colormaps. (They have different intensity ranges). I know that colormap is a property of the figure. I could not manage to do that so I decided that displaying the contour of the second image on top of the first would also work.
h = imshow(I);colormap(jet)
hold on
[C,hc]=contour(I2);
child_handles = get(hc,'Children');
Contour has the same colormap with the image as well. I wanted to control the color property of the contour by accessing the handles of each patch object. I can specify a color for each patch if necessary (but there are many patches) but I could not manage to define a colormap.
I would appreciate any help on this. Thanks, Gokcen.

Answers (2)

Laura Proctor
Laura Proctor on 11 May 2011
Each figure has its own colormap, so you wouldn't be able to have two images in the same figure with one colormap. You may have some luck by converting the images to true color images. Use the IND2RGB function to achieve this. The input values are your indexed image along with the colormap, and then the output will be a true-color image.

Walter Roberson
Walter Roberson on 11 May 2011

Community Treasure Hunt

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

Start Hunting!