GPT答: |
https://ask.gongduoduo.com
|
```matlab
% 读取Lena图像
lena = imread('lena.png');
% 等比例放大1.7倍
lena_enlarge = imresize(lena, 1.7);
% 等比例缩小0.5倍
lena_shrink = imresize(lena, 0.5);
% 非等比例放大到840×768像素
lena_nonuniform_enlarge = imresize(lena, [840, 768]);
% 非等比例缩小到300×360像素
lena_nonuniform_shrink = imresize(lena, [300, 360]);
% 显示结果图像
subplot(2,3,1), imshow(lena), title('Original Lena');
subplot(2,3,2), imshow(lena_enlarge), title('Enlarged Lena (1.7x)');
subplot(2,3,3), imshow(lena_shrink), title('Shrunken Lena (0.5x)');
subplot(2,3,[4:6]), imshowpair(imresize(lena,[840 NaN]), lena_nonuniform_enlarge,'montage'), title('Non-uniform Enlargement');
```
|