how to display an image
3 ビュー (過去 30 日間)
古いコメントを表示
Hello, i have a part of a program that recognizes my letters, everything looks nice the program recognized. But I have such a problem, I would like to show it in the program. After doing this, how do you present it in the form as in the attachment. I am pasting the code below
for n= 1: length(propied)
BBs= propied(n).BoundingBox;
subImage= imresize(imcrop(im, BBs), [150 80]);
baseFileName = sprintf('Obraz #%d.png', n);
fullFileName = fullfile(string(newSubFolder(1)), baseFileName);
imwrite(~subImage, fullFileName);
hold on;
subplot (1, 8, n);
set(gcf, 'Position', get(0,'Screensize'));
figure(11), imshow(subImage);
end
close all;
0 件のコメント
回答 (3 件)
Spectro
2021 年 11 月 30 日
M = ones(400, 200);
tiledlayout(1, 6, 'TileSpacing', 'tight')
nexttile;imshow(M)
nexttile;imshow(M)
nexttile;imshow(M)
nexttile;imshow(M)
nexttile;imshow(M)
nexttile;imshow(M)
0 件のコメント
Image Analyst
2021 年 12 月 1 日
Looks like it should work, though I'd pull figure(11) outside the loop and put it before the loop. Did it now work like you expected? This is how I'd do it (untested):
% Create a new figure called hFig.
hFig = figure();
numDigits = length(propied);
for n = 1 : numDigits
% Crop out this digit from the larger image and resize it to 150 rows by 80 columns.
BBs = propied(n).BoundingBox;
subImage = imresize(imcrop(im, BBs), [150, 80]);
% Display this subimage in its own axes.
subplot (1, numDigits, n);
imshow(subImage);
% Create a filename and save the subimage to its own disk file.
baseFileName = sprintf('Obraz #%d.png', n);
fullFileName = fullfile(string(newSubFolder(1)), baseFileName);
imwrite(~subImage, fullFileName);
end
g = gcf;
g.WindowState = 'maximized';
% Ask user if they want to close the figure.
promptMessage = sprintf('Do you want to close the figure now?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Yes', 'No - leave it up', 'Yes');
if contains(buttonText, 'Yes', 'IgnoreCase', true)
% They want to close it.
close(hFig);
end
0 件のコメント
yanqi liu
2021 年 12 月 1 日
yes,sir,may be use
figure(11); clf;
set(gcf, 'Position', get(0,'Screensize'));
for n= 1: length(propied)
BBs= propied(n).BoundingBox;
subImage= imresize(imcrop(im, BBs), [150 80]);
baseFileName = sprintf('Obraz #%d.png', n);
fullFileName = fullfile(string(newSubFolder(1)), baseFileName);
imwrite(~subImage, fullFileName);
figure(11);
subplot (1, 8, n);
imshow(subImage, []);
end
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!