# Image Scaling
###### tags: `Advanced Digital Image Processing`
### <font color="axis">Nearest neighbor Interpolation</font>
> 考試作弊看離你最近的同學的答案 -> 參考1個點
找離你最近的 pixel 是多少
|||
|:---:|:---:|
### <font color= "axis"> Linear Interpolation( 方便後面介紹 Bilinear Interpolation ) </font>
> 考試作弊看左右的同學的答案 -> 參考2個點
在兩點區間內找到另一點
||
|:---:|
|兩鄰點 : (x0, y0) 與 (x1, y1)|
|target : (x, y) |
||
### <font color= "axis"> Bilinear Interpolation </font>
> 考試作弊看前後左右的同學的答案 --> 參考4個點
在兩個方向分別進行一次 linear interpolation ( 如下圖,Q12 與 Q22 找到 R2,Q11 與 Q21 找到 R1,R2 與 R1 找到 P )
| |
|:---:|
|四鄰點:Q11(x1,y1) 、 Q12(x1,y2) 、 Q21(x2,y1) 、 Q22(x2,y2)|
|距離:a'' = x2 - x 、 b'' = y2 - y 、 a' = x2 - x1 、 b' = y2 - y1 、 a = x - x1、b= y - y1|
|intensity value : Q11 -> p1, Q21 -> p2, Q12 -> p3, Q22 -> p4 |
|target : P = ( a'' b'' p1 + a b'' p2 + b a'' p3 + a b p4 ) / ( a' * b' )|
### <font color= "axis"> Bicubic Interpolation</font>
> 考試作弊看附近的同學的答案 -> 參考16個點
||
|:---:|
|ref. : https://www.jianshu.com/p/caada12ccd48|
| 利用下方曲線針對鄰近點分配權重 |
|:---:|
||
|權重公式|
||
| target |
||
### <font color= "axis"> Summary </font>
- Nearest neighbor Interpolation : 直接拿鄰近點來填值
- linear Interpolation : 在一個方向上利用線性差值
- Bilinear Interpolation : 在兩個方向上利用線性差值
- Bicubic Interpolation : 在兩個方向上利用曲線差值