Bilinear interpolation of an image or matrix

Version 1.1.0.0 (3.28 KB) by Disi A
This function performs bilinear interpolation for a given image or matrix at any location
4.1K Downloads
Updated 17 Jun 2016

View License

This function uses biLinear interpolation and looks at 4 pixels around the target location with ceil convention.
--RGB = 1 for gray scale images.
--img can be a single layer matrix or a RGB layer colored image
--yx =[y_value, x_value]; It can be either horizontal or vertical vector
--zpad is a boolean variable. if true, zeros are used for pixel values outside of the given img. If false, the nearest edge value is repeated.
Example:
[m,n]=meshgrid(1:3);img=[m+n]
--> 2 3 4
3 4 5
4 5 6
interpImg(img,[2.4,2.2])
--> 4.6
Disi A
adis@mit.edu

Cite As

Disi A (2024). Bilinear interpolation of an image or matrix (https://www.mathworks.com/matlabcentral/fileexchange/43533-bilinear-interpolation-of-an-image-or-matrix), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0.0

Typo fixed.
Implemented Bug fix suggested by Sanjuro, Thank you!

1.0.0.0