image resampling

版本 1.3.0.0 (1.7 KB) 作者: Omer Demirkaya
This is a simple function that resamples the image at a different pixel size
5.3K 次下载
更新时间 2010/9/6

查看许可证

function nimg = imresample(oldpixsize,img,newpixsize,intmethod)

% This function resamples the images at the new grid points
% defined by the new pixel sizes. It assumes that intensities are
% defined at pixel centers
%
% img : original image to be resampled
% nimg : newly sampled image
% oldpixsize : a vector of the form [xpixsize, ypixsize]
% for the original image, e.g., [0.5,0.5]
% newpixsize : is a vector of the form [xpixsize, ypixsize]
% for the new image, e.g., [0.2,0.2]
% intmethod: same as interp2
% 'nearest' - nearest neighbor
% 'linear' - bilinear
% 'cubic' - bicubic
% 'spline' - spline

% Example:
%
% % Create a 2D gaussian function
% H = fspecial('gaussian',[31,31],5);
% % Resample it at a smaller pixel size
% NH = imresample([1,1],H,[0.2,0.2],'spline');
% figure;subplot(211);imshow(H,[]);title('Original');
% subplot(212);imshow(NH,[]);
% title('Resampled using spline interplolation');

引用格式

Omer Demirkaya (2024). image resampling (https://www.mathworks.com/matlabcentral/fileexchange/22443-image-resampling), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R14SP3
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.3.0.0

It is modified so it can resample multispectral (e.g., color) images.

1.2.0.0

It is just reuploading nothing new.

1.1.0.0

I just added an example image. The image is kindly provided by William Samson and a nice example to show resampling.

1.0.0.0