378人阅读 评论(0)

# Bilinear Interpolation

### Bilinear

Bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables (e.g., x and y) on a rectilinear 2D grid1

Suppose that we want to find the value of the unknown function f$f$ at the point P(x,y)$P(x, y)$. It is assumed that we know the value of f$f$ at the four points  Q11(x1,y1),Q12(x1,y2),Q21(x2,y1),Q22(x2,y2) $~Q_{11}(x_1,y_1), Q_{12}(x_1,y_2),Q_{21}(x_2,y_1),Q_{22}(x_2,y_2)~$.

We first do linear interpolation in the x-direction. This yields

f(R1)x2xx2x1f(Q11)+xx1x2x1f(Q21),R1=(x,y1)
f(R2)x2xx2x1f(Q12)+xx1x2x1f(Q22),R2=(x,y2)

We proceed by interpolating in the y-direction to obtain the desired estimate

f(P)=y2yy2y1f(R1)+yy1y2y1f(R2)(x2x)(y2y)(x2x1)(y2y1)f(Q11)+(xx1)(y2y)(x2x1)(y2y1)f(Q21)+(x2x)(yy1)(x2x1)(y2y1)f(Q12)+(xx1)(yy1)(x2x1)(y2y1)f(Q22)

To restore damaged pixels in the image using the bilinear interpolation, we should first find the good pixels at both four directions near the specific pixel, and then we can calculate the rgb value of it by

f=afright+bfdown+cfleft+dfupa+b+c+d,bfdown+dfupb+d,afright+cflefta+c,if |(a+c)(b+d)|20if a+c>b+d+20if b+d>a+c+20

Now, for our test, we take a photo of mine shown below(dong.jpg):

And then, we can damage it by adding tons of characters, just like this(dong_dmg.jpg):

In order to restore the damaged photo, firstly we mark out the damage parts in the photo by PhotoShop(dong_font.jpg):

After the bilinear interpolation, the output image would be:

Also, it is somewhere diffrent from the source photo, but is still effective enough for damage restore.

0
0

【直播】机器学习&数据挖掘7周实训--韦玮
【套餐】系统集成项目管理工程师顺利通关--徐朋
【直播】3小时掌握Docker最佳实战-徐西宁
【套餐】机器学习系列套餐（算法+实战）--唐宇迪
【直播】计算机视觉原理及实战--屈教授
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之矩阵--黄博士
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之凸优化--马博士
【套餐】Javascript 设计模式实战--曾亮

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：84693次
• 积分：2307
• 等级：
• 排名：第16158名
• 原创：155篇
• 转载：6篇
• 译文：0篇
• 评论：7条
阅读排行
最新评论