imresize 百科内容来自于: 百度百科

MATLAB函数imresize简介

函数功能

该函数用于对图像做缩放处理。在matlab的命令窗口中输入doc imresize或者help imresize即可获得该函数的帮助信息。

调用格式

B = imresize(A, m)
返回的图像B的长宽是图像A的长宽的m倍,即缩放图像。 m大于1, 则放大图像; m小于1, 缩小图像。
B = imresize(A, [numrows numcols])
numrows和numcols分别指定目标图像的高度和宽度。 显而易见, 由于这种格式允许图像缩放后长宽比例和源图像长宽比例不相同,因此所产生的图像有可能发生畸变。
[Y newmap] = imresize(X, map, scale)
[...] = imresize(..., method)
method参数用于指定在改变图像尺寸时所使用的算法, 可以为以下几种:
'nearest': 这个参数也是默认的, 即改变图像尺寸时采用最近邻插值算法;
'bilinear':采用双线性插值算法;
'bicubic': 采用双三次插值算法,在R2013a版本里,默认为这种算法,所以不同版本可能有不同的默认参数,使用之前建议使用命令help imresize获得帮助信息,以帮助信息为准;
[...] = imresize(..., parameter, value,...)

相关概念

相关函数:
imrotate, imtransform, tformarray,interp2in the MATLAB FunctionReference

程序示例

示例一

Shrink by factor of two using the defaults of bicubic interpolationand antialiasing.
I = imread('rice.png');
J = imresize(I, 0.5);
figure, imshow(I), figure, imshow(J)

示例二

Shrink by factor of two using nearest-neighbor interpolation. (This is the fastest method, but it has the lowest quality.)
J2 = imresize(I, 0.5, 'nearest');

示例三

Resize an indexed image
[X, map] = imread('trees.tif');
[Y, newmap] = imresize(X, map, 0.5);
imshow(Y, newmap)

示例四

Resize an RGB image to have 64 rows. The number of columnsis computed automatically.
RGB = imread('peppers.png');
RGB2 = imresize(RGB, [64 NaN]);
$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定