https://www.paulinternet.nl/?page=bicubic

Cubic interpolation

If the values of a function f(x) and its derivative are known at x=0 and x=1, then the function can be interpolated on the interval [0,1] using a third degree polynomial. This is called cubic interpolation. The formula of this polynomial can be easily derived.

A third degree polynomial and its derivative:

The values of the polynomial and its derivative at x=0 and x=1:

The four equations above can be rewritten to this:

And there we have our cubic interpolation formula.

Interpolation is often used to interpolate between a list of values. In that case we don't know the derivative of the function. We could simply use derivative 0 at every point, but we obtain smoother curves when we use the slope of a line between the previous and the next point as the derivative at a point. In that case the resulting polynomial is called a Catmull-Rom spline. Suppose you have the values p0, p1, p2and p3 at respectively x=-1, x=0, x=1, and x=2. Then we can assign the values of f(0), f(1), f'(0) and f'(1) using the formulas below to interpolate between p1 and p2.

Combining the last four formulas and the preceding four, we get:

So our cubic interpolation formula becomes:

For example:

For the green curve:

The first and the last interval

We used the two points left of the interval and the two points right of the inverval as inputs for the interpolation function. But what if we want to interpolate between the first two or last two elements of a list? Then we have no p0 or no p3. The solution is to imagine an extra point at each end of the list. In other words, we have to make up a value for p0 and p3 when interpolating the leftmost and rightmost interval respectively. Two ways to do this are:

    • Repeat the first and the last point.
      Left: p0 = p1
      Right: p3 = p2
    • Let the end point be in the middle of a line between the imaginary point and the point next to the end point.
      Left: p0 = 2p1 - p2
      Right: p3 = 2p2 - p1

转载:Cubic interpolation的更多相关文章

  1. 【转载】interpolation(插值)和 extrapolation(外推)的区别

    根据已有数据以及模型(函数)预测未知区域的函数值,预测的点在已有数据范围内就是interpolation(插值), 范围外就是extrapolation(外推). The Difference Bet ...

  2. Interpolation in MATLAB

    Mathematics     One-Dimensional Interpolation There are two kinds of one-dimensional interpolation i ...

  3. MATLAB曲面插值及交叉验证

    在离散数据的基础上补插连续函数,使得这条连续曲线通过全部给定的离散数据点.插值是离散函数逼近的重要方法,利用它可通过函数在有限个点处的取值状况,估算出函数在其他点处的近似值.曲面插值是对三维数据进行离 ...

  4. OpenCV基于傅里叶变换进行文本的旋转校正

    傅里叶变换可以用于将图像从时域转换到频域,对于分行的文本,其频率谱上一定会有一定的特征,当图像旋转时,其频谱也会同步旋转,因此找出这个特征的倾角,就可以将图像旋转校正回去. 先来对原始图像进行一下傅里 ...

  5. 通过python将图片生成字符画

    基础知识: 1.python基础知识   快速学习链接:https://www.shiyanlou.com/courses/214 2.linux命令行操作   快速学习链接:https://www. ...

  6. Deep Learning 16:用自编码器对数据进行降维_读论文“Reducing the Dimensionality of Data with Neural Networks”的笔记

    前言 论文“Reducing the Dimensionality of Data with Neural Networks”是深度学习鼻祖hinton于2006年发表于<SCIENCE > ...

  7. Line Search and Quasi-Newton Methods 线性搜索与拟牛顿法

    Gradient Descent 机器学习中很多模型的参数估计都要用到优化算法,梯度下降是其中最简单也用得最多的优化算法之一.梯度下降(Gradient Descent)[3]也被称之为最快梯度(St ...

  8. Line Search and Quasi-Newton Methods

    Gradient Descent 机器学习中很多模型的参数估计都要用到优化算法,梯度下降是其中最简单也用得最多的优化算法之一.梯度下降(Gradient Descent)[3]也被称之为最快梯度(St ...

  9. 非刚性图像配准 matlab简单示例 demons算法

    2011-05-25 17:21 非刚性图像配准 matlab简单示例 demons算法, % Clean clc; clear all; close all; % Compile the mex f ...

随机推荐

  1. [大数据技术]Kettle初次连接MySQL数据库 报错问题 错误连接数据库 Error occured while trying to connect to the database Exception while loading class org.gjt.mm.mysql.Driver

    报错内容如下: 错误连接数据库 [foodmartconn] : org.pentaho.di.core.exception.KettleDatabaseException: Error occure ...

  2. 【剑指Offer】62、序列化二叉树

    题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 二叉树的序列化是指:把一棵二叉树按照某种遍历方式的结果以某种格式保存为字符串,从而使得内存中建立起来的二叉树可以持久保存.序列化可以基于先序. ...

  3. 论文-MobileNet-V1、ShuffleNet-V1、MobileNet-V2、ShuffleNet-V2、MobileNet-V3

    1.结构对比 1)MobileNet-V1 2)ShuffleNet-V1 3)MobileNet-V2 4)ShuffleNet-V2

  4. qt creator源码全方面分析(1)

    目录介绍 首先我们对软件源代码根目录下的各个重要文件(夹)做一个简单的介绍,对整体有一个大概的了解. 下面对目录及其内容做一个大概的初步的介绍,后面我尽量按照目录顺序进行依次介绍,当然可能会有一些交叉 ...

  5. processing data

    获取有效数据 Scikit-learn will not accept categorical features by default API里面不知使用默认的特征变量名,因此需要编码 这里我还是有疑 ...

  6. laravel 解决 sql mode only_full_group_by

    this is incompatible with sql_mode=only_full_group_by 先贴报错是这样的哦,sql 中使用到了 group by 然后这是mysql-5.7以上版本 ...

  7. IO流学习之字符流(二)

    用字符流完成文档的复制: 测试文档: 代码1: package InputOutput; import java.io.FileReader; import java.io.FileWriter; i ...

  8. 权限问题 <customErrors> 标记的“mode”属性设置为“Off”

    引用 权限问题 <customErrors> 标记的“mode”属性设置为“Off”. 权限问题标记的“mode”属性设置为“Off”.说明: 服务器上出现应用程序错误.此应用程序的当前自 ...

  9. Python Django文件上传

    文件保存本地 view视图 def update(request): if request.method =='GET': return render(request,'update.html') e ...

  10. IDEA 找不到包或者找不到符号的一些解决办法

    有时使用IDE导入项目后,启动时会发生找不到包或者找不到符号的情况,下面有一些处理方法 1.右键项目Maven→Reimport 2.IDEA窗口左上角File→Invalidate and Rest ...