, . . , for, , , . , while, , .
, , 1.5 , .
, , . , for, , , , , . , , , , , . cameraman.tif , 256 x 256, , , . , imresize MATLAB, , 0.5 2. , while , , , 1. , , .
:
%
im = imread('cameraman.tif');
[rows,cols] = size(im);
%
out = zeros(rows, round(1.5*cols), 'uint8');
out(:,1:cols) = im; %
%
im_resize = imresize(im, 0.5, 'bilinear');
[rows_resize, cols_resize] = size(im_resize);
out(1:rows_resize,cols+1:cols+cols_resize) = im_resize;
%
rows_counter = rows_resize + 1;
%
while (true)
%
im_resize = imresize(im_resize, 0.5, 'bilinear');
%
[rows_resize, cols_resize] = size(im_resize);
%
out(rows_counter:rows_counter+rows_resize-1, cols+1:cols+cols_resize) = ...
im_resize;
%
rows_counter = rows_counter + rows_resize;
%
%
if rows_resize == 1 || cols_resize == 1
break;
end
end
%
figure;
imshow(out);
, :
