2010-10-21 86 views
11

我:設置窗口/圖片標題

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

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

如何設置標題在每張圖片?

回答

12

您想要更改數字窗口的屬性Name

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') 

另外,如果你調用imshow(g,[]),它會自動縮放圖像以最低/最高。

+0

不錯!這是窗口的標題:)。你能否告訴我如何改變圖片上的文字(在窗口中)? – 2010-10-21 19:09:00

+0

???錯誤使用==> title at 29 錯誤輸入參數數量 錯誤==> title at 23 h = title(gca,varargin {:});這是當我嘗試使用標題('gca','你也可以放置這樣的標題') – 2010-10-21 19:12:21

+1

@Miko Kronn:修正了錯誤。 'gca'不應該在引號中。順便說一句:如果有幫助,請不要忘記接受答案。 – Jonas 2010-10-21 19:25:03