How to display 518*518 resolution gray scale images in small axes, with gray scale only

Hi, I am new to MATLAB.I want to display 7 Images all of are gray scale images on The screen, for that i have taken 7 axes.
But when the image gets displayed in axes they are not appear in gray scale, they appear as colour images and when the same
image is displayed in Figure window it is displayed as original gray scale image. My images size is 518*518.i want the images
to be in gray scale only in all the axes. How to solve this problem? and also i don't want to reduce the
size of the images. Thanks in advance

Answers (1)

There is one colormap per figure, so a single colormap(gray) will do. However if you need to display a color image somewhere in the same figure, you are going to run in to problems.
The easiest way to solve these problems would be to take your grayscale image and use
RGBImage = repmat(GrayImage,1,1,3);
and then display RGBImage . This will convert the image from being a pseudocolor image affected by colormaps, in to being a truecolor image that is independent of colormaps.

3 Comments

Hello Sir, When i try Your code given above but it gives me an Error Too many input arguments for Function repmat. I also read the topic from the Help on repmat but i am not able to understand it. I change some of the parameters but it won't work.Plz guide me.
This is explained well in the help text.
RGBImage = repmat(GrayImage, [1,1,3])
Another approach:
RGBImage = cat(3, GrayImage, GrayImage, GrayImage);
Or:
RGBImage = GrayImage(:, :, ones(1,3));
Hi, Thanks for ur help. But one problem is when i tried to perform the convolution with RGBImage ,i get the error :- "Error
while evaluating uicontrol Callback". Why this? when the same code is working perviously when the Original gray scale image
come in colour.

Sign in to comment.

Asked:

on 14 Dec 2011

Community Treasure Hunt

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

Start Hunting!