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

6 views (last 30 days)
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'

Accepted Answer

Image Analyst
Image Analyst on 5 Sep 2013
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);

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!