pyagg.gridinterp module
Various interpolation algorithms in pure Python. Karim Bahgat 2015
- Point interpolation of sample points to a grid of unknown values.
- Grid interpolation of values from source to destination grids with different coords.
- Basic image resampling of pixel values to new image dimensions.
Functions
def gridinterp_bilin(
oldgrid, oldxs, oldys, newxs, newys)
Bilinear interpolation
'each of the grid points in the dest grid contains the average of the nearest four grid points in the source grid, weighted by their distance from the destination grid point. If any of the four surrounding input grid points contain missing data, the interpolated value will be flagged as missing.'
http://www.iges.org/grads/gadoc/gradfunclterp.html
def gridinterp_near(
oldgrid, oldxs, oldys, newxs, newys)
Nearest neighbour interpolation...
NOTE: oldxs and oldys must both be increasing in size for some unknown reason.
def img_resize_bilinear(
grid, w2, h2)
From techalgorithm.com
def img_resize_near(
grid, w2, h2)
From techalgorithm.com
def pointinterp_idw(
points, gridxs, gridys, neighbours=None, sensitivity=None)
Inverse distance weighing