1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| clear all
close all
clc
bigImage = imread('rose.jpg');
[bigRows bigColumns] = size(bigImage);
subplot(2, 2, 1);
imshow(bigImage, []);
caption = sprintf('Big Image - %d rows by %d columns', ...
bigRows, bigColumns);
title(caption, 'FontSize', 16);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
smallImage = imread('carré.jpg');
[smallRows smallColumns] = size(smallImage);
subplot(2, 2, 2);
imshow(smallImage, []);
caption = sprintf('Small Image - %d rows by %d columns', ...
smallRows, smallColumns);
title(caption, 'FontSize', 16);
% set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
compositeImage = bigImage;
% Find a place to put the image.
row1 = 57;
col1 = 110;
row2 = row1 + smallRows - 1;
col2 = col1 + smallColumns - 1;
compositeImage(row1:row2, col1:col2) = uint8(single(smallImage));
subplot(2, 2, 3);
imshow(compositeImage, []);
caption = sprintf('Composite Image - %d rows by %d columns', ...
bigRows, bigColumns);
title(caption, 'FontSize', 16); |
Partager