Can anyone describe a 2d interpolation method that is better than bilinear interpolation?

I have a grid of data points in which I am currently using bilinear interpolation to find the missing points in the grid. I pointed to Kriging's directions as the best linear impartial evaluator, but I couldn't find any good source code or algebraic explanation. Does anyone know of any other interpolation methods that I could use?

- @Sam Greenhalgh update I reviewed the Bicubic Interpolation but the results I got using the code I found seemed to be off.

Here is some sample code for Bicubic

Note. I am coding in C #, but I welcome examples from other languages.

    //array 4
    double cubicInterpolate(double[] p, double x)
    {
        return p[1] + 0.5 * x * (p[2] - p[0] + x * (2.0 * p[0] - 5.0 * p[1] + 4.0 * p[2] - p[3] + x * (3.0 * (p[1] - p[2]) + p[3] - p[0])));
    }
    //array 4 4
   public double bicubicInterpolate(double[][] p, double x, double y)
    {
        double[] arr = new double[4];
        arr[0] = cubicInterpolate(p[0], y);
        arr[1] = cubicInterpolate(p[1], y);
        arr[2] = cubicInterpolate(p[2], y);
        arr[3] = cubicInterpolate(p[3], y);
        return cubicInterpolate(arr, x);
    }

double[][] p = {
                new double[4]{2.728562594,2.30599759,1.907579158,1.739559264},
                new double[4]{3.254756633,2.760758022,2.210417411,1.979012766},
                new double[4]{4.075740069,3.366434527,2.816093916,2.481060234},
                new double[4]{5.430966401,4.896723504,4.219613391,4.004306461}
               };

Console.WriteLine(CI.bicubicInterpolate(p, 2, 2));

      

+3


source to share


1 answer


One commonly used interpolation technique is kriging (or Gaussian process regression).

However, using kriging is not recommended if your data points are on a regular grid. Euclidean distances between data points are used to adjust model parameters. But the grid has much fewer distance values ​​than, say, a random multipoint simulation.

However, even if your data points are regularly posted, it would be fun to try. If you are interested, you can use the following programs:



  • DiceKriging package in R language (there are others like kriging, gstat ...)
  • DACE toolbar in Matlab
  • STK in Matlab / Octave
  • And many others (e.g. in python) ...

NOTE. It is interesting to note (I'm not exactly in what context you want to apply kriging) that the kriging interpolation property can be easily mitigated to account for possible measurement errors, for example.

+2


source







All Articles