How can Matlab make a title for all figures, according to the "imread" input image.

1 次查看(过去 30 天)
I'm doing image processing on images, and a lot of figures are plotted. I am reading in one image at a time in, perform some functions and then have outputs. I want the result figure to show a title that will show what image I was working on, before looping to a next image.
Leernaam has .png images for instance diaretdb1_image002.png
Thus: imageIN = imread(LeerNaam);
image processing .... result=bw.*I;
figure, imshow(result), ... title ' I want it to display diaretdb1_image002 automatically, because imageIN used it and all processing was done on imageIN'

采纳的回答

Image Analyst
Image Analyst 2013-9-5
Use sprintf() to create a string that you can use for a title, for example:
caption = sprintf('Working on %s\nImage #%d out of %d',...
filename, currentImageNumber, totalNumberOfImages);
If you want the title to appear above just the current axes, then you can use title():
title(caption, 'FontSize', 24);
otherwise, you can use set() to send the caption to a static text label control:
set(handles.text1, 'String', caption);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by