2.0

2.0 | 2 ratings Rate this file 78 downloads (last 30 days) File Size: 1.62 KB File ID: #22443

image resampling

by Omer Demirkaya

 

15 Dec 2008 (Updated 13 May 2009)

Code covered by BSD License  

This is a simple function that resamples the image at a different pixel size

Download Now | Watch this File

File Information
Description

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');

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements it uses only meshgrid and interp2 functions
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
19 Jan 2009 kranthi kumar  
12 May 2009 Cris Luengo

There's no m-file, only a JPG.

28 May 2009 Fernando Díaz

interesting

Please login to add a comment or rating.
Updates
10 May 2009

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

13 May 2009

It is just reuploading nothing new.

Tag Activity for this File
Tag Applied By Date/Time
image processing Cristina McIntire 15 Dec 2008 15:47:18
function Cristina McIntire 15 Dec 2008 15:47:24
pixel Cristina McIntire 15 Dec 2008 15:47:37
resampling Omer Demirkaya 15 Dec 2008 15:47:40
image processing Omer Demirkaya 15 Dec 2008 15:47:40
image processing Mark 18 Aug 2009 13:43:45
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com