How can I show image titles in MATLAB figures? I have the following code below:
I=imread('./../images/pap.png');
subplot(1,2,1);
imshow(I); % here I want to show labels
To display image data, use the imshow function. The following example reads an image into the workspace and then displays the image in a figure window using the imshow function. You can also pass imshow the name of a file containing an image. imshow('moon.
Create Title and SubtitleCreate a plot. Then create a title and a subtitle by calling the title function with two character vectors as arguments. Use the 'Color' name-value pair argument to customize the color for both lines of text. Specify two return arguments to store the text objects for the title and subtitle.
imshow( I ,[]) displays the grayscale image I , scaling the display based on the range of pixel values in I . imshow uses [min(I(:)) max(I(:))] as the display range. imshow displays the minimum value in I as black and the maximum value as white. For more information, see the DisplayRange argument.
Use the title
command. It works pretty much like plot
. imshow
spawns a new figure so you can apply commands that you would for any figure in here. By using title
, you will give your image a title and it appears at the top of your image.
As such:
I=imread('./../images/pap.png');
subplot(1,2,1);
imshow(I);
title('Labels'); % Place title here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With