- 119 Views
- Uploaded on
- Presentation posted in: General

Resampling

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Resampling

- improfile(f,[XFP x],[YFP y],search_radius,'bicubic');
- f：原圖
- [ ] ：座標
- search_radius ：點數
- bicubic：函式

- 雙線性內插法(bilinear interpolation)
- 實際上為連續記算三次線性內插的結果
- 與最近相鄰內插法一樣，利用相鄰四點求取新的像素值
- 下頁式子中的α、β為點p對應鄰近四點的相對水平與垂直距離
- 假設點與點間距離為1 ， 故 0 < α、β < 1

3

- 作法
- 第一次線性內插
- 即a 、b兩點對p的影響，可求出e點像素

- 第二次線性內插
- 即c 、d兩點對p的影響，可求出f點像素

- 最後對e 、f兩點做內插
可求得p點像素

- 第一次線性內插

4

- //計算bilinear需要的alpha,beta值
- alpha = point_x - prepoint_x ;
- beta = 1 - ( point_y - prepoint_y ) ;
- //start bilinear interpolation
- gray_a = ( 1 - alpha ) * *( pImage + 8 * ( prepoint_x ) + ( prepoint_y + 1 ) ) + alpha * *( pImage + 8 * ( prepoint_x + 1 ) + ( prepoint_y + 1 ) ) ;
- gray_b = ( 1 - alpha ) * *( pImage + 8 * ( prepoint_x ) + ( prepoint_y ) ) + alpha * *( pImage + 8 * ( prepoint_x + 1 ) + ( prepoint_y ) ) ;
- last_gray = ( 1 - beta ) * gray_a + beta * gray_b ;
- gray_value[ count1++ ] = ( int )last_gray ;