• 沒有找到結果。

三. 邊緣可適應性彩色影像縮放硬體實現

3.4 演算法實現

3.4.4 影像內插法硬體實現

(2) 邊緣 邊緣 邊緣 邊緣適 適 適 適應 應 應 應性內插法 性內插法 性內插法 性內插法(Edge-Adaptive Interpolation)

Extend 8-bit Y-Pixel 8-bit

Extend 8-bit Weight 8-bit

32-bit Result

Fig. 3-28. Y 像素和權重之乘法

四 四

四 四. . . . 實驗結果 實驗結果 實驗結果 實驗結果

4.1 HVS 硬體實驗結果 硬體實驗結果 硬體實驗結果 硬體實驗結果

經由前一章結的討論後,可以針對硬體的實現提出兩個實驗結果,第一可以和灰階 架構[21]所輸出的結果做一個比較,如圖 4-2(b)所示可以看出在灰階架構中的輸出,可 以看出房屋的屋簷邊會有些許的鋸齒情形,再對照彩色架構所輸出的結果已將這鋸齒問 題給解決,第二我們也選擇了 6 張彩色圖片輸入到硬體電路上來執行如圖 4-1 所示,和 雙線性內插法來做比較在邊緣的處理都較為平滑,另外也選了其中的 3 張圖片如圖 4-6 ~ 4-8 和過去的 HVS 使用的軟體模擬做 PSNR 的比較如表 4-1,由於 PSNR 並不是百分之 百的準確性,主要是 PSNR 的大部份是使用在影像壓縮後結果來和原圖做相比,但對於 影像補插的計算,PSNR 的對照表主要是做為和其它內插法的實驗的結果來做為一個比 較。

(a) (b) (c)

(d) (e) (f)

Fig. 4-1. (a) 房屋[28] (b) 跑車[29] (c) 戰鬥機[30] (d) Lena[31] (e) 街道[32] (f) 燈塔[33]

(a)

(b)

I

Fig. 4-2. (a) 房屋原始圖片 (b) 灰階架構放大圖片 (c) 彩色架構放大圖片

(a)

(b) (c)

Fig. 4-3. (a) 房屋彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用 HVS 可適性放大

(a) (b)

(c)

Fig. 4-4. (a) 跑車彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用 HVS 可適性放大

(a) (b)

(c)

Fig. 4-5. (a) 戰鬥機彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用 HVS 可適性放大

(a)

(b) (c)

Fig. 4-6.(a) Lena彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用HVS可適性放大

(a)

(b) (c)

Fig. 4-7. (a) 街道彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用HVS可適性放大

(a) (b) (c)

Fig. 4-8. (a) 燈塔彩色原始圖片 (b) 使用雙線性內插法放大 (c) 使用HVS可適性放大

經由實驗的結果將圖4-6,4-7,4-8做PSNR計算如表4-1所示從過去一些其它內插法 相比較來看PSNR都較為高,和HVS軟體模擬的結果比較誤差為RMSE (Root Mean Square Error ) ≈ 0.11497,另外和過去灰階架構[21]相比較PSNR也較高。

Table 4-1.各種內插法PSNR之比較 Bilinear

[2]

Bicubic [3]

NN-Based [4]

Edge-Directed [5]

Aqua [11]

HVS [1]

Gray HW [21]

This work MSE 62.85 64.38 50.47 77.36 27.17 19.99 28.76 20.98 Lena

PSNR 30.15 30.04 31.10 29.24 33.78 35.12 33.54 34.91 MSE 94.46 102.24 80.28 53.09 55.51 51.58 61.72 53.46 Goldhill

PSNR 28.37 28.02 29.09 30.88 30.68 31.01 30.22 30.85 MSE 251.26 264.22 225.43 353.78 234.11 222.71 259.3 225.59 Lighthouse

PSNR 24.15 23.91 24.6 22.64 24.43 24.65 23.99 24.60

4.2 FPGA 硬體實現 硬體實現 硬體實現 硬體實現

彩色影像縮放硬體實現是根據DE2-70 FPGA硬體開發平台來完成演算法及整個系 統的設計,透過這塊開發平台所提供的硬體資源如,表4-2所示核心的部份有一顆Altera

Cyclone II EP2C70 FPGA晶片做為演算法硬體的實現,介面部份有SSRAM可以高速的存

取影像資料能夠暫時存放彩色影像資料,將設計好的電路可透過USB介面從PC端將RTL code燒錄到DE2-70 FPGA中的Cyclone II EP2C70 FPGA晶片,在系統中有規劃兩個影像 來源,其中以ADV7180視頻解碼器如圖4-9所示從TV端子如所輸入NTSC信號轉換成數 位ITU-R.656數位影像格式,將彩色影像資料先暫時存放在高速SSRAM中,最後再送到 FPGA晶片做演算法運算。另一個影像來源是預先將彩色影像資料存放於外部Flash記憶 體中如圖4-10所示,經由Flash記憶體控制電路來讀取影像資料,並將影資料先暫時存放 在高速SSRAM中,最後再傳送到FPGA晶片做演算法運算。

Fig. 4-9. 系統平台影像來源為視頻解碼晶片

Fig. 4-10. 系統平台影像來源為 Flash 記憶體

Table 4-2. DE2-70 FPGA 板硬體資源 項目

項目 項目

項目 硬體功能硬體功能硬體功能硬體功能

FPGA (Cyclone II EP2C70) 演算法核心及周邊控制電路

SSRAM (IS61LPS51236A) 高速存取記憶體可暫時存放彩色影像資料

FLASH(S29GL064A) 存放彩色影像資料

視訊解碼晶片 視訊解碼晶片 視訊解碼晶片

視訊解碼晶片(ADV7180) 可經由視訊端子輸入 NTSC 訊號再將類比訊號轉換為數位訊號

TFT LCD 介面介面介面介面(GPIO) 顯示縮放圖片

4.2.1 電路面積效能及 電路面積效能及 電路面積效能及 電路面積效能及架構設計的比較 架構設計的比較 架構設計的比較 架構設計的比較

從表4-3中可以得知彩色架構的電路面積比灰階架構少了一半以上,因為採用Line Buffer資料處理,內部記憶體所使用的面積也少了很多 ;在效能的提升上系統頻率可以達 到130 MHz如表4-4所示。

Table 4-3.架構及電路面積比較表

Gray Architecture This work

VD No Yes

SD Yes Yes

Algorithm

CD Yes Yes

Processes Memory

160 × 120 × 2 For Input 320 × 240 × 2 For Output Total : 187.5 k Byte

Y Pixel 720 × 6

U & V Pixel 360 × 4 × 2 Total : 7 k Byte

Processes Method Frame Buffer Processes Line Buffer Processes Input Image source TV decode TV decode & NOR Flash

Input/Output Pixel Gray Pixel (8-Bit 0~255) Color Pixel (YUV 4:2:2) Total Logic Element 20,017 / 68,416(29%) 9,064 / 68,416(13%)

Logic Register 2,343/68416(3%) 1,235/68416(1%) Total Memory bits 775,760/1,152,000(67%) 86,400/1,152,000(8%)

PLL 2 sets 1 sets

Table 4-4.效能比較

Old Performance New Performance System Frequency

(max) 42MHz 130MHz

Data Load

Algorithm 5,210,551ns 2,275,813ns

4.2.3 軟體及硬體效能比較 軟體及硬體效能比較 軟體及硬體效能比較 軟體及硬體效能比較

從表4-5所示在軟體模擬在PC上的Cycle數大於硬體的Cycle數,比較條件如下所示 : (1) 輸入影像解析度: 160 × 120 (Gray Level)

(2) 輸出影像解析度: 320 × 240

(3) 放大倍數: 2 倍 軟體語言: C++ Language PC 速度為 3GHz (6) 硬體效能上角度及直方圖電路為平行處理

Table 4-5.軟體及硬體效能比較表

Executing Cycles S/W performance H/W performance Ratio

VD 11,701,733 18,369 637

SD 8,760,938 15,997 547

CD 4,595,220 8,820 521

Angle 156,255,100

Histogram 83,276,307 141,120 1697

Total 264,589,298 184,306 1436(1)

(1) SW_Cycle/HW_Cycle = 264,589,298/184,306 = 1436

由表4-5可知,硬體的效能比軟體的執行效能快1436倍,因為硬體在處理資料的 運算中是平行而且在模糊決策系統(VD,SD,CD)中的演算法及角度的計算不需花費太多

的週期(Cycle),而在軟體上雖然在PC上執行的速度非常快,但對於每一個演算法中的

指令所需的週期(Cycle)數確實大於硬體,故在硬體上的執行比較能夠得到較好的效能。

4.2.4 影像放大處理效能 影像放大處理效能 影像放大處理效能 影像放大處理效能

經由估算的結果,硬體在處理完一張彩色圖片時,所所需的時間如表4-6所示:輸 入圖像的大小是720 × 240,放大倍數為2,輸出圖片解析度為1440 × 480,經由影像資料 的載入到演算法的運算法以及到資料的輸出,所花費的時間為14.98 ms。

Table 4-6.彩色圖片放大處理效能

Cycles Times Total cycles Total time

Load Buffer

(YUV Pixels) 2160 235 507600 3.9 ms

Load_reg_36_y Load_reg_18_u Load_reg_18_v

3 168025 504075 3.87 ms

VD 1 149152 149152 1.147 ms

SD 1 128810 128810 0.99 ms

CD 1 77374 77374 0.59 ms

Angle 16 77374 77374 0.59 ms

Data_out 3 168025 504075 3.87 ms

Total 14.98 ms

五 五

五 五. . . . 結論及未來展望 結論及未來展望 結論及未來展望 結論及未來展望

在本論文,以人類視覺系統為基礎之彩色影像縮放硬體實現。在這項設計中採用模 糊決策系統對於輸入彩色影像(YUV 4:2:2)中人眼較為敏感的 Y 像素特徵,來決定何種 內插法將被使用。如果輸入影像對於人類眼睛較不敏感,為減少計算能力,故採用雙線 性內插法。否則,使用邊緣適應性內插法,以減少模糊或鋸齒邊緣部分缺陷。在模糊決 策系統演算法中的 VD,因為使用到背景亮度參數(BL)需使用到除法器,在硬體的設計 上採用少許的加法器、減法器以及除數和商數的查表做為硬體的一個實現,而 V(BL)中 的指數函數建立一個查表,並透過背景亮度參數(BL)可以快速的找到所要的 V(BL)函 數,SD 及 CD 可以利用較為簡單的組合邏輯電路來完成,透過 CORDIC 電路的實現取 代反正切函數,用於計算輸入影像中的方向。此種方法在經由 16-bit 的定點轉換可以取 得較精確的值使得誤差值可以降到最小;在 U 像素及 V 像素的補插點中所採用是雙線 性內插法,因為人類的眼睛在色差部份較不敏感,對於電路面積也較為節省。本論文的 硬體設計對於過去的硬體架構缺點也做了一些改善詳細說明如下:

(1) 從過去架構中只能以灰階的方式來處理及顯示,彩色架構採用彩色影像可以滿 足人類視覺。

(2) 在彩色架構中雖然使用大量彩色影像資料,並不會影響電路的面積而且使得電 路面積比灰階架構少了一半以上。

(3) 在彩色架構中在影像放大之後,已消除灰階架構中所產生一些雜訊問題,並使 邊緣變得更為平滑。

(4) 採用Line Buffer處理可以使得FPGA內部的記憶體更為減少。

儘管這一篇論文已將彩色圖片的縮放實現於硬體上,但對於未來仍需要改善的一些 問題如下:

1. 不同的放大比例

在影像縮放的硬體可能需要更大的比例,對於在輸出影像中可以看到更高

解析的影像。

2. 周邊電路的模組化

在設計硬體對於一些周邊控制電路的設計,如果能夠規劃出一組標準規格 的介面每一個周邊控制電路都根據這一組規格的介面來設計可以減少設計的時 間。

3. 演算法參數設定

如果要將此論文中的硬體規劃成ASIC,可經由一些外部周邊介面(I2C)來設 定演算法內部所需的變數設定如放大倍數。

參考文件 參考文件 參考文件 參考文件

[1] C. T. Lin, K. W. Fan, H. C. Pu, S. M. Lu, and S. F. Liang, “An HVS-Directed Neural-Network-Based Image Resolution Enhancement Scheme for Image Resizing,”

IEEE Transactions on Fuzzy Systems, vol.15, no.4, pp.605-615, Aug. 2007.

[2] C. C. Wei and C. H. Chen, “Generalized Bilinear Interpolation of Motion Vectors for Quad-Tree Mesh,” International Conference on Intelligent Information Hiding and Multimedia Signal Processing 15-17 pp.635-638 Aug. 2008.

[3] Z. Xiang, X. Zou, and Z. Liu, “An High Quality Image Scaling Engine for Large-scale LCD,” International Conference on Signal Processing, vol. 1, pp.16-20 Nov. 2006 [4] F. M. Candocia and J. C. Principe, “Super-resolution of images based on local

correlations,” IEEE Transactions on Neural Network, vol. 10, no. 2, pp. 372–380, 1999.

[5] Z. Shi, S. Yao, and Y. Zhao “A novel video image scaling algorithm based on morphological edge interpolation,” International Conference on Neural Networks and Signal Processing 7-11 pp. 388 – 391, June 2008.

[6] B. K. Gunturk, Student Member, IEEE, Y. Altunbasak, Senior Member, IEEE, and R. M.

Mersereau, Fellow, IEEE “Color Plane Interpolation Using Alternating Projections”

IEEE Transactions on Image Process, vol. 11, no. 9, September 2002.

[7] Amanatiadis, I. Andreadis, and A. Gasteratos, “A Log-Polar Interpolation Applied to Image Scaling” IEEE International Workshop on Imaging Systems and Techniques, 5-5 pp. 1-5, May, 2007

[8] I. Andreadis and A. Amanatiadis, “Digital Image Scaling,” Instrumentation and Measurement Technology Conference, 2005. Proceedings of the IEEE, vol. 3, 16-19 pp.

2028–2032, May 2005.

[9] J. Allebach and P. W. Wong, “Edge-directed interpolation,” International Conference on Image Processing, vol.3, 16-19 pp.707-710, Sept 1996.

[10] X. Li and M. T. Orchard, “New edge-directed interpolation,” IEEE Transactions on Image Processing, vol.10, no.10, pp.1521-1527, Oct 2001.

[11] D. D. Muresan and T. W. Parks, “Adaptively quadratic (Aqua) image interpolation,”

IEEE Transactions on Image Processing, vol.13, no.5, pp. 690-698, May 2004.

[12] S. W. Lee and J. K. Paik, “Image interpolation using adaptive fast b-spline filtering,”

International Conference on Acoust., Speech, Signal Process, vol. 5, pp. 177-180 vol.5, 8-13 Mar 1993.

[13] M. M. L, S. D. G and S. R, “An image resizing algorithm for binary maps,” Digital Object Identifier pp.126 – 132 2004

[14] B. S. Morse and D. Schwartzwald, “Isophote-based interpolation,” International

Conference on Image Processing. 4-7 vol.3, pp.227-231 Oct 1998.

[15] K. Ratakonda and N. Ahuja, “POCS based adaptive image magnification,” International Conference on Image Processing, 4-7 vol.3, pp.203-207 Oct 1998.

[16] C. T. Lin and C. S. G. Lee, “Neural Fuzzy Systems: A Neuro-Fuzzy Synergism to Intelligent Systems. Englewood Cliffs”, NJ: Prentice-Hall, 1996.

[17] C. T. Lin, Y. C. Lee, and H. C. Pu, “Satellite sensor image classification using cascaded architecture of neural fuzzy network,” IEEE Transactions on Geoscience and Remote Sensing, vol.38, no.2, pp.1033-1043, Mar 2000.

[18] C. H. Chou and Y. C. Li, “A perceptually tuned subband image coder based on the measure of just-noticeable-distortion profile,” IEEE Transactions on Circuits and Systems for Video Technology, vol.5, no.6, pp.467-476, Dec 1995.

[19] A. A. A. Amanatiadis, I. I. Andreadis, and K. K. Konstantinidis, “Design and Implementation of a Fuzzy Area-Based Image-Scaling Technique,” IEEE Transactions on Instrumentation and Measurement, vol. 57, no 8, pp. 1504- 1513 Aug. 2008.

[20] K. Jack, “YcbCr to RGB Considerations” For information regarding Intersil Corporation and its products, website available at http://www.intersil.com March 1997 [21] Y. C. Lo, “FPGA Implementation of Edge-Adaptive Interpolation Hardware for

Real-Time Digital Image Resizing,” Master thesis, National Chiao Tung University in Electrical and Control Engineering,July 2008.

[22] R. Andraka “A survey of CORDIC algorithm for FPGA based computers” Andraka Consulting Group, Inc 1998 ACM

[23] High-definition television - Wikipedia, the free encyclopedia [24] Sinc function - Wikipedia, the free encyclopedia

[25] RGB color model - Wikipedia, the free encyclopedia [26] http://imajr.com/New2.aspx?1=red-house-1551128.jpg

[27] http://imajr.com/Original.aspx?Id=normal-496f1793a2eb9-0000.bmp-1551133 [28] http://imajr.com/Original.aspx?Id=house2.bmp-1551131

[29] http://www.0755car.com/n/xw/xcsd/gw/08-12-31/89775.html

[30] LIFE Lockheed Martin F-22 fighter plane flyin... - Hosted by Google [31] http://www.hlevkin.com/TestImages/lenna.bmp

[32] http://www.hlevkin.com/TestImages/goldhill.bmp [33] http://www.blaisdell.org/Pemaquid%20Lighthouse..htm

相關文件