Setting the position of an image in a figure
28 ビュー (過去 30 日間)
古いコメントを表示
I have three images in the figure as shown below.
1. I want to display these three images at the center of the figure. How can I do it?
2. I want that automatically the value of mean for each figure is picked from the variable and displayed under each image. How can I do it?
Please explain. Thank you.
0 件のコメント
採用された回答
Image Analyst
2016 年 1 月 28 日
Use subplot(), mean2(), and xlabel():
fontSize = 20;
% Make 3 images.
grayImage1 = imread('cameraman.tif');
grayImage2 = imread('moon.tif');
grayImage3 = imread('pout.tif');
% Display image 1 and mean of that image.
subplot(1, 3, 1);
imshow(grayImage1, []);
title('cameraman.tif', 'FontSize', fontSize, 'Interpreter', 'None');
mean1 = mean2(grayImage1);
caption = sprintf('Mean = %.2f', mean1);
xlabel(caption, 'FontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Display image 2 and mean of that image.
subplot(1, 3, 2);
imshow(grayImage2, []);
title('moon.tif', 'FontSize', fontSize, 'Interpreter', 'None');
theMean = mean2(grayImage2);
caption = sprintf('Mean = %.2f', theMean);
xlabel(caption, 'FontSize', fontSize);
% Display image 3 and mean of that image.
subplot(1, 3, 3);
imshow(grayImage3, []);
title('pout.tif', 'FontSize', fontSize, 'Interpreter', 'None');
mean3 = mean2(grayImage3);
caption = sprintf('Mean = %.2f', mean3);
xlabel(caption, 'FontSize', fontSize);
3 件のコメント
Image Analyst
2016 年 1 月 28 日
Right, because subimage() puts stitched images in one axes. To put labels on that, you'd have to use the text() function to put a test string into the overlay of the image.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!