问题 设置窗口/图片标题


我有:

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

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

如何在每张图片上设置标题?


6376
2017-10-21 19:02


起源



答案:


你想改变 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,[]),它会自动将图像缩放到最小/最大。


12
2017-10-21 19:04



太好了!这是窗口的标题:)。你能告诉我如何在图片上更改文字(在窗口中)吗? - Miko Kronn
???错误使用==> title at 29错误输入参数数量错误==>标题23 h = title(gca,varargin {:});这是当我尝试使用标题('gca','你也可以放置这样的标题') - Miko Kronn
@Miko Kronn:修正了错误。 gca 不应该在引号中。顺便说一下:如果有帮助,请不要忘记接受答案。 - Jonas


答案:


你想改变 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,[]),它会自动将图像缩放到最小/最大。


12
2017-10-21 19:04



太好了!这是窗口的标题:)。你能告诉我如何在图片上更改文字(在窗口中)吗? - Miko Kronn
???错误使用==> title at 29错误输入参数数量错误==>标题23 h = title(gca,varargin {:});这是当我尝试使用标题('gca','你也可以放置这样的标题') - Miko Kronn
@Miko Kronn:修正了错误。 gca 不应该在引号中。顺便说一下:如果有帮助,请不要忘记接受答案。 - Jonas