2D interpolation

The preceding function is for the univariate case. There's only one variable, x, and one output variable, y, but we can do 2D interpolation. In fact, we can do interpolation for any number of dimensions. Here, we will look at only 2D interpolation and I'm going to demonstrate interpolation for image resizing. So, we have an image; we will consider this image as being in a matrix, and we'll be working with a grayscale image. A pixel's intensity will be a function's y value, and its location on a grid will be its x value, where x is actually a vector with two coordinates. It's easier, in my opinion, to normalize everything so that the upper-left corner is (0, 0) and the bottom-right corner is (1, 1). This means that everything ...

Get Training Systems Using Python Statistical Modeling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.