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. [Python自学] Flask框架 (1) (Flask介绍、配置、Session、路由、请求和响应、Jinjia2模板语言、视图装饰器)

    oldboy:s9day114 参考博客:https://www.cnblogs.com/wupeiqi/articles/7552008.html 一.Flask简介 1.安装Flask pip i ...

  2. Fragment基础学习

    https://blog.csdn.net/lmj623565791/article/details/37970961

  3. ie8兼容rgba写法

    ie使用filter解决半透明兼容性问题 filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#19ffffff,endCo ...

  4. 侧信道攻击,从喊666到入门之——Unicorn的环境构建

    作者:backahasten 发表于小米安全中心微信公众号 0x00 前言 Unicorn可以模拟多种指令集的代码,在很多安全研究领域有很强大的作用,但是由于需要从头自己布置栈空间,代码段等虚拟执行环 ...

  5. Callablestatement与JavaBean及其实例

    一. Callablestatement:调用 数据库中的存储过程.存储函数 connection.prepareCall(参数:存储过程/存储函数名)参数格式:存储过程:(无返回值return,用O ...

  6. 亚马逊云推出基于机器学习的企业搜索服务Kendra,剑指微软

    近日,在AWS re:Invent全球大会上,亚马逊发布了五项新的基于机器学习的人工智能 (AI) 服务. 这五项服务包括机器学习驱动的企业搜索.代码审核与分析.欺诈检测.医疗转录和 AI 预测的人工 ...

  7. 0010 基于DRF框架开发(03 模型序列化器)

    序列化器:是指从数据库提取数据,转化前端所需要的数据格式并返回到前端. 反序列化器:是指把前端传回的数据,转换成数据库需要的格式,存入数据库. DRF提供了两种序列化器: 模型序列化器:是指和模型关联 ...

  8. 0008 基于DRF框架开发(01 DRF开发的基本流程)

    1 创建模型 由于之前在<004 工程配置>中,已在Applications/Organizations/models中创建了一个UserInfo模型.此处引用这个模型. from dja ...

  9. css使用padding-bottom百分比进行提前占位,防止抖动

    页面加载抖动问题 在web开发中,经常会遇到这样一个问题,比如一个宽度百分百,高度自适应的图片,在网速慢的情况下加载过程中会出现抖动的问题(未加载图片前容器的高度为0,图片加载完成后下面的内容会被挤下 ...

  10. 2020牛客寒假算法基础集训营4-F树上博弈

    链接:https://ac.nowcoder.com/acm/contest/3005/F来源:牛客网 题目描述 现有一个 n 个点,n-1条边组成的树,其中 1 号点为根节点. 牛牛和牛妹在树上玩游 ...