Presentation is loading. Please wait.

Presentation is loading. Please wait.

計算攝影學 Final Project 影像縮放內插法 on MFC介面

Similar presentations


Presentation on theme: "計算攝影學 Final Project 影像縮放內插法 on MFC介面"— Presentation transcript:

1 計算攝影學 Final Project 影像縮放內插法 on MFC介面
2014/01

2 Outline Project 說明 最近相鄰內插法(nearest-neighbor interpolation)
立方內插法(cubic interpolation) 線性內插法(linear interpolation) MFC介面簡介 速度分析比較 DEMO 應用

3 Project 說明 由程式載入一張256x256的影像,再由外部輸入任意一個倍數的 長寬大小,將原圖依照輸入比例放大或縮小,放大縮小的演算 法分別使用Linear與cubic的內插,並且比較花費時間與影像品 質。

4 Project 說明 程式在得知輸入的放大或縮小倍數後,要先利用迴圈算出輸出 影像每個pixels所對應到原始影像上的位置,由於放大或是縮小 不一定是整數倍,所以算出的位置可能會有小數點,因此依照 下面不同的演算法,以不同的參考點與權重來求得輸出影像點 pixels的數值。

5 Project 說明 例如:下圖放大MxM後的(X,Y)點,可以經過運算後對應到原圖256x256上的(X’,Y’)座標。 MM
256256 (X’,Y’) 放大 256256 NN 縮小

6 最近相鄰內插法(nearest-neighbor interpolation)
定義 從目的影像推回原始影像時,產生像素無值的情況 藉由四個相鄰近的點來求出新值 作法 選擇一個最接近距離整數位置的像素填上

7 最近相鄰內插法(nearest-neighbor interpolation)
若與多個鄰近點距離相同 任選其一為其像素值 將非整數座標四捨五入後取該點像素值 改變距離的計算方式

8 立方內插法(cubic interpolation)
1-D立方內插法是參考最近的四個點為參考點,依照所算出的x'座標與四點的距離關係依照R3(u)得到權重,再將權重分別乘以參考點數值相加,即可算出。而權重的算法會因為距離不同,而有不同的算法。

9 線性內插法(linear interpolation)
1-D線性內插法是參考最近的兩個點為參考點,依照所算出的F座標與兩點的距離關係得到權重 ,再將權重分別乘以參考點數值相加,即可算出。

10 MFC類別函式庫 MFC類別函式庫 MFC(Microsoft Foundation Class Library)是一套整合在VC++中供開發視窗程式用的類別函式庫,提供了豐富的類別函式供程式設計師來開發各類的視窗應用程式。

11 MFC類別函式庫 使用MFC開發視窗程式的優點 一、程式架構簡單 二、各類別功能涵蓋範圍廣
三、簡化使用Windows API來開發程式的難度

12 MFC類別函式庫 視窗程式開發兩種架構 一、使用Windows API 二、使用MFC
使用MFC來開發程式比較簡單,並且在MFC程式中亦可直接呼叫使用Windows API中的函式。 不過在程式的執行效能上,使用Windows API所開發出的程式在執行速度上則會比較快,對於講求執行速度的程式,如遊戲程 式,通常會以Windows API來做為程式開發的基礎。 Windows API MFC 應用程式

13 結果比較 內插演算法花費時間比較表 (時間不包括載入原始影像與輸出影像,只有演算法部分) linear花費時間 cubic花費時間
linear花費時間 cubic花費時間 nearest花費時間 放大(432432) 0.009秒 0.008秒 0.006秒 放大(555555) 0.014秒 0.013秒 縮小(234234) 0.003秒 0.002秒 縮小(199199) 0.001秒 影像品質

14 結果比較 1-D linear interpolation(線性內插法)

15 結果比較 1-D cubic interpolation(立方內插法)

16 結果比較 nearest-neighbor interpolation(鄰近內插法)

17 結果比較 cubic linear nearest

18 DEMO 連結 DEMO影片

19 應用The Laplacian Pyramid as a Compact Image Code
The encoding process is equivalent to sampling the image with Laplacian operators of many scales. Thus, the code tends to enhance salient image features. P. Burt and T. Adelson. The Laplacian Pyramid as a Compact Image Code. IEEE Transactions on Communication, COM-31:532–540, 1983.

20 應用The Laplacian Pyramid as a Compact Image Code
P. Burt and T. Adelson. The Laplacian Pyramid as a Compact Image Code. IEEE Transactions on Communication, COM-31:532–540, 1983.

21 應用The Laplacian Pyramid as a Compact Image Code
可以簡化影像融合時的運算,只須對金字塔中每一層的資訊利用簡單的混和係數進行縫合,就可以經由重建過程中使用的濾波器擴大效應 P. Burt and T. Adelson. The Laplacian Pyramid as a Compact Image Code. IEEE Transactions on Communication, COM-31:532–540, 1983.

22 應用 加快運算時間 如:Laplacian Pyramid 影像品質提升 如:Bilsteral Grid 影像細節保留
Ref:1983_IEEE_The Laplacian Pyramid as a Compact Image Code 影像品質提升 如:Bilsteral Grid Ref:2007_ACM_Real-time Edge-Aware Image Processing with the Bilateral Grid 影像細節保留 Ref :2007_ACM_Detail preserving shape deformation in image editing

23 The End


Download ppt "計算攝影學 Final Project 影像縮放內插法 on MFC介面"

Similar presentations


Ads by Google