views:

24

answers:

1

I have:

img = imread('pic.jpg','jpg');
r = img(:,:,1);
g = img(:,:,2);
b = img(:,:,3);

figure, imshow(r);
figure, imshow(g);
figure, imshow(b);

How to set title over each picture?

+4  A: 

You want to change the Name-property of the figure window.

img = imread('pic.jpg','jpg');
r = img(:,:,1);
g = img(:,:,2);
b = img(:,:,3);

figure('Name','this is the red channel'), imshow(r);
figure('Name','this is the green channel','NumberTitle','off'), imshow(g);
title(gca,'you can also place a title like this')    

fh = figure; imshow(b);
set(fh,'Name','this is the blue channel')

Also, if you call imshow(g,[]), it will auto-scale the image to min/max.

Jonas
Nice! This is title of window:). Can you also tell me how to change Text over picture (in window)?
Miko Kronn
??? Error using ==> title at 29Incorrect number of input argumentsError in ==> title at 23 h = title(gca,varargin{:}); This is when i try using title('gca','you can also place a title like this')
Miko Kronn
@Miko Kronn: fixed the error. `gca` should not be in quotes. Btw: Please don't forget to accept an answer if it was helpful.
Jonas

related questions