熊 煒 趙詩云 徐晶晶 趙 楠,2
1(湖北工業(yè)大學(xué)電氣與電子工程學(xué)院 湖北 武漢 430068)2(湖北工業(yè)大學(xué)太陽能高效利用湖北省協(xié)同創(chuàng)新中心 湖北 武漢 430068)
?
低質(zhì)量文檔圖像二值化算法研究
熊煒1,2*趙詩云1徐晶晶1趙楠1,2
1(湖北工業(yè)大學(xué)電氣與電子工程學(xué)院湖北 武漢 430068)2(湖北工業(yè)大學(xué)太陽能高效利用湖北省協(xié)同創(chuàng)新中心湖北 武漢 430068)
摘要針對低質(zhì)量文檔圖像中存在的墨跡浸潤、頁面污漬或背景紋理等退化因素,提出一種低質(zhì)量文檔圖像二值化算法。算法首先基于文檔圖像的局部對比度實現(xiàn)字符筆畫像素檢測,然后采用Otsu算法對其進(jìn)行全局最優(yōu)閾值化處理,最后通過估計字符筆畫寬度確定鄰域窗尺寸,從而實現(xiàn)字符前景與頁面背景的精細(xì)分割。實驗結(jié)果表明,該算法在F-measure、PSNR、SSIM、NRM、DRD等性能指標(biāo)方面較其它經(jīng)典的文檔二值化算法具有明顯優(yōu)勢。該算法不僅能夠較好地保留筆畫細(xì)節(jié)外,還能夠較好地抑制文檔背景。
關(guān)鍵詞低質(zhì)量文檔圖像二值化局部圖像對比度筆畫寬度估計
0引言
文檔分析與識別(DAR)技術(shù)廣泛應(yīng)用于印刷體字符及公式識別、手寫文字識別、文檔圖像分割、視頻字幕提取、文本信息檢索等領(lǐng)域。主要包括圖像采集、預(yù)處理、二值化、版面分析、OCR識別、建立索引等流程[1]。圖像二值化是其中一個關(guān)鍵處理步驟,它直接影響DAR系統(tǒng)的性能。然而,由于圖像對比度低、墨跡浸潤、頁面污漬或光照不均等諸多因素,使得針對此類低質(zhì)量文檔圖像的二值化具有極大的挑戰(zhàn)。
目前,學(xué)術(shù)界提出了許多文檔圖像二值化算法,可大致分為全局閾值法和局部閾值法[2,3]。全局閾值法采用單一的閾值將文檔圖像分為字符(前景)與背景兩大類。如Otsu算法[4]利用圖像的灰度直方圖選擇一個最優(yōu)閾值,使得經(jīng)閾值分割后的前景與背景像素的類間方差最大。Otsu算法對于前景和背景差別較大,即直方圖具有顯著雙峰特征的圖像具有較好的分割效果,但在處理低質(zhì)量文檔圖像時,會丟失部分甚至全部前景細(xì)節(jié)。
局部閾值法(也稱為自適應(yīng)閾值法)通過滑動窗口與文檔圖像卷積,從而實現(xiàn)在圖像不同部分設(shè)定不同閾值。如Niblack[5]、Sauvola[6]、Wolf[7]等算法利用像素鄰域內(nèi)的灰度均值和標(biāo)準(zhǔn)差來構(gòu)建閾值分割曲面,其性能有賴于滑動窗口的尺寸及字符筆畫的粗細(xì)。針對不同質(zhì)量的文檔圖像需動態(tài)調(diào)整窗口尺寸,以獲得最佳的閾值處理結(jié)果,當(dāng)圖像對比度較低時,會產(chǎn)生大量噪聲點或?qū)⒈尘跋袼卣`判為前景像素。
國內(nèi)外研究人員還提出了許多其他方法,如背景估計法[8,9]、局部對比度法[10-12]、筆畫邊緣檢測法[13]、梯度歸一化與顯著圖法[14]、紋理分析法[15]、拉普拉斯能量法[16]、誤差擴(kuò)散法[17]、譜聚類法[18]以及混合法[19]。然而這些方法都不能很好地解決低質(zhì)量文檔圖像的二值化問題或者僅能適用于某些特定場景(如光照不均勻條件[20])。本文結(jié)合圖像局部對比度和筆畫寬度估計,提出一種新的文檔圖像二值化方案,該算法對墨跡浸潤、頁面污漬、背景紋理等多種退化因素具有較好的魯棒性。
1算法介紹
1.1局部圖像對比度
(1)
其中,Imax(x,y)、Imin(x,y)和Imean(x,y)分別表示圖像在其坐標(biāo)(x,y)處的3×3鄰域內(nèi)亮度的最大值、最小值和平均值。
1.2全局最優(yōu)閾值化
局部對比度圖像明顯改善了原始文檔圖像的直方圖特性,使其具有相對顯著的雙峰模態(tài),因此可以采用經(jīng)典的Otsu算法[4]對其進(jìn)行全局最優(yōu)閾值化處理,從而實現(xiàn)高對比度字符筆畫像素檢測。
(2)
1.3筆畫寬度估計與局部二值化
經(jīng)過全局最優(yōu)閾值化方法檢測出的像素點大多位于字符筆畫邊緣附近,且圖像前景像素的灰度值應(yīng)接近或略低于這些被檢測出的像素平均灰度。因此,一旦這些“種子”像素點被正確檢測出來,就能夠精細(xì)地從原始文檔圖像中將字符前景與頁面背景分割:
(3)
其中,I(x,y)為(x,y)處的像素灰度值,μs(x,y)和σs(x,y)分別表示以(x,y)為中心的w×w鄰域內(nèi)所有“種子”像素的灰度平均值和標(biāo)準(zhǔn)偏差,常數(shù)k的取值受Sauvola算法[6]及Wolf算法[7]的啟示固定為0.5。
由前面的分析可知,基于鄰域窗的算法性能依賴于鄰域窗尺寸大小及字符筆畫粗細(xì)等因素,并且這些因素之間也是相關(guān)的,即文檔字符筆畫粗(或細(xì)),對應(yīng)的鄰域窗尺寸則大(或小)。因此,確定鄰域窗尺寸大小也就轉(zhuǎn)化為筆畫寬度估計(SWE)問題。目前,研究人員主要采用行程長度、法向量、輪廓比例、頻譜等方法來估計筆畫寬度[21]。本文采用對圖像分辨率變化具有魯棒性的輪廓比例法[22]進(jìn)行筆畫寬度估計。首先計算字符前景像素與對應(yīng)的字符邊界像素的比值λ:
(4)
通過大量實驗得到:
(5)
一般而言,鄰域窗的尺寸不能小于筆畫寬度,同時考慮到實時計算量,本文將鄰域窗的尺寸大小設(shè)為字符筆畫寬度的兩倍,即w=2×SWE。
2實驗與分析
將本文提出的算法與其他10種經(jīng)典算法進(jìn)行對比實驗,選取國際文檔圖像二值化競賽(DIBCO)[23-25]提供的低質(zhì)量文檔圖像集作為測試樣例,包括21張印刷體和21張手寫體(共42張)低質(zhì)量文檔圖像及其對應(yīng)的標(biāo)定(GT)圖像。參與評估的各算法分別對測試樣例進(jìn)行二值化處理,將輸出的二值圖像與對應(yīng)的GT圖像進(jìn)行像素級比較,并采用F值(F-measure)、峰值信噪比(PSNR)、結(jié)構(gòu)相似度(SSIM)、錯誤率度量(NRM)、距離倒數(shù)失真度量(DRD)、錯誤分類處罰指標(biāo)(MPM)等性能指標(biāo)進(jìn)行算法評估。有關(guān)SSIM的具體原理請參見文獻(xiàn)[26],其余5個性能指標(biāo)的具體定義請參考文獻(xiàn)[23-25]。其中,前3個性能指標(biāo)值越大越好,其余3個性能指標(biāo)值越小越好。表1為各算法的性能評估結(jié)果(平均值),可以看出,本文提出的算法在多個性能指標(biāo)中具有明顯優(yōu)勢。
表1 算法評估的數(shù)值結(jié)果(平均值)
對比各算法的輸出結(jié)果(如圖1所示),可以看出,Bernsen和Niblack算法輸出圖像會產(chǎn)生大量噪聲點,即將背景像素誤判為前景像素;BESE算法對于頁面大部分文字能夠?qū)崿F(xiàn)正確分割,但對于中脊處文字細(xì)節(jié)全部丟失;BGT和Otsu算法對于目標(biāo)和背景差別較大,即直方圖具有顯著雙峰特征的文檔圖像具有較好的分割效果,但在中文低質(zhì)量文檔圖像二值化實驗時,頁面中脊處以及弱筆畫文字細(xì)節(jié)部分丟失;Feng算法檢測出的字符筆畫不連續(xù)或者僅能檢測出筆畫邊緣(即形成空心字);LMM算法輸出圖像邊緣處文字為空心字,內(nèi)部文字分割較正確,但中脊處部分文字細(xì)節(jié)丟失;NICK算法檢測出的部分筆畫不連續(xù),對于粗筆畫文字會產(chǎn)生空洞現(xiàn)象;相比Sauvola算法,Wolf算法能夠抑制更多的背景像素,但其前景文字也相對較淡,即同時抑制了部分前景像素;本文提出的算法不僅能夠較好地保留筆畫細(xì)節(jié)外,還能夠較好地抑制文檔背景。
圖1 低質(zhì)量文檔圖像與各算法對比實驗結(jié)果
3結(jié)語
本文提出了一種基于局部對比度的低質(zhì)量文檔圖像二值化方法。該算法能夠較好地保留字符筆畫細(xì)節(jié),在有效分割字符前景的同時,還能夠較好地抑制墨跡浸潤、頁面污漬、紋理背景不均勻等現(xiàn)象。通過與其他10種經(jīng)典算法的比較,本文提出的算法在F-measure、PSNR、SSIM、NRM、DRD等性能指標(biāo)方面具有明顯優(yōu)勢。
參考文獻(xiàn)
[1] Rabeux V,Journet N,Vialard A,et al.Quality evaluation of degraded document images for binarization result prediction[J].International Journal on Document Analysis and Recognition,2014,17(2):125-137.
[2] Sezgin M,Sankur B.Survey over image thresholding techniques and quantitative performance evaluation[J].Journal of Electronic Imaging,2004,13(1):146-168.
[3] Chang C I,Du Y,Wang J,et al.Survey and comparative analysis of entropy and relative entropy thresholding techniques[J].IEE Proceedings-Vision Image and Signal Processing,2006,153(6):837-850.
[4] Otsu N.A threshold selection method from gray-level histograms[J].IEEE Transactions on Systems,Man and Cybernetics,1979,9(1):62-66.
[5] Niblack W.An introduction to digital image processing[M].Englewood Cliffs,New Jersey:Prentice-Hall International Inc.,1986.
[6] Sauvola J,Pietik Inen M.Adaptive document image binarization[J].Pattern Recognition,2000,33(2):225-236.
[7] Wolf C,Jolion J M,Chassaing F.Text localization, enhancement and binarization in multimedia documents[C]//Proceedings of the 16th International Conference on Pattern Recognition (ICPR), Quebec City, Canada, Aug, 2002.
[8] Lu S,Su B,Tan C L.Document image binarization using background estimation and stroke edges[J].International Journal on Document Analysis and Recognition,2010,13(4):303-314.
[9] 許海洋,馬龍龍,吳健.基于背景估計和邊緣檢測的文檔圖像二值化[J].計算機(jī)應(yīng)用與軟件,2014,31(8):196-200.
[10] Bernsen J.Dynamic thresholding of gray-level images[C]//Proceedings of the International Conference on Pattern Recognition (ICPR),1986.
[11] Su B,Lu S,Tan C L.Binarization of historical document images using the local maximum and minimum[C]//Proceedings of the 9th IAPR International Workshop on Document Analysis Systems,Boston,MA,USA,Jun,2010.
[12] Su B,Lu S,Tan C L.Robust document image binarization technique for degraded document images[J].IEEE Transactions on Image Processing,2013,22(4):1408-1417.
[13] Chen Q,Sun Q S,Ann Heng P,et al.A double-threshold image binarization method based on edge detector[J].Pattern Recognition,2008,41(4):1254-1267.
[14] 胡麗娜.低質(zhì)量文檔圖像的二值化研究 [D].南京理工大學(xué),2012.
[15] Sehad A,Chibani Y,Cheriet M,et al.Ancient degraded document image binarization based on texture features[C]//Proceedings of the 8th International Symposium on Image and Signal Processing and Analysis (ISPA), Trieste,Italy, Sept., 2013.
[16] Howe N R.A laplacian energy for document binarization[C]//Proceedings of the International Conference on Document Analysis and Recognition (ICDAR), Beijing, Sept., 2011.
[17] 焦雪,張樹功.基于誤差擴(kuò)散的圖像二值化 [J].吉林大學(xué)學(xué)報:理學(xué)版,2014,52(3):541-545.
[18] 吳銳,黃劍華,唐降龍,等.基于灰度直方圖和譜聚類的文本圖像二值化方法[J].電子與信息學(xué)報,2009,31(10):2460-2464.
[19] Ntirogiannis K,Gatos B,Pratikakis I.A combined approach for the binarization of handwritten document images[J].Pattern Recognition Letters,2014,35(1):3-15.
[20] 郭佳,劉曉玉,吳冰,等.一種光照不均勻圖像的二值化方法[J].計算機(jī)應(yīng)用與軟件,2014,31(3):183-186,202.
[21] Ramirezortegon M A,Margner V,Rojas R,et al.An objective method to evaluate stroke-width measures for binarized documents[C]//Proceedings of the 12th International Conference on Document Analysis and Recognition (ICDAR), Washington, DC, Aug., 2013.
[22] Valizadeh M,Kabir E.An adaptive water flow model for binarization of degraded document images[J].International Journal on Document Analysis and Recognition (IJDAR),2013,16(2):165-176.
[23] Gatos B,Ntirogiannis K,Pratiakis I.ICDAR 2009 Document Image Binarization Contest (DIBCO 2009)[C]//Proceedings of the 10th International Conference on Document Analysis and Recognition (ICDAR), Barcelona, July, 2009.
[24] Pratikakis I,Gatos B,Ntirogiannis K.ICDAR 2011 Document Image Binarization Contest (DIBCO 2011)[C]//Proceedings of the 11th International Conference on Document Analysis and Recognition (ICDAR),Beijing, Sept., 2011.
[25] Pratikakis I,Gstos B,Ntirogiannis K.ICDAR 2013 Document Image Binarization Contest (DIBCO 2013)[C]//Proceedings of the 12th International Conference on Document Analysis and Recognition (ICDAR), Washington, DC, Aug., 2013.
[26] Wang Z,Bovik A C,Sheikh H R,et al.Image quality assessment: From error visibility to structural similarity[J].IEEE Transactions on Image Processing,2004,13(4):600-612.
[27] Gonzalez R C,Woods R E,Eddins S L.Digital image processing using MATLAB[M].2nd ed.Gatesmark Publishing,2009.
[28] Feng M L,Tan Y P.Contrast adaptive binarization of low quality document images[J].IEICE Electronics Express,2004,1(16):501-506.
[29] Khurshid K,Siddiqi I,Faure C,et al.Comparison of Niblack inspired binarization methods for ancient documents[C]//Proc SPIE 7247,Document Recognition and Retrieval XVI,San Jose,CA,Jan.,2009.
收稿日期:2015-01-07。國家自然科學(xué)基金面上項目(61471162);太陽能高效利用湖北省協(xié)同創(chuàng)新中心開放基金重點項目(HBSKF ZD2014011);湖北工業(yè)大學(xué)科研啟動基金項目(BSQD12022)。熊煒,講師,主研領(lǐng)域:圖像分析與理解,機(jī)器視覺,增強(qiáng)現(xiàn)實。趙詩云,碩士生。徐晶晶,碩士生。趙楠,講師。
中圖分類號TP751
文獻(xiàn)標(biāo)識碼A
DOI:10.3969/j.issn.1000-386x.2016.07.047
RESEARCH ON DEGRADED DOCUMENT IMAGE BINARISATION
Xiong Wei1,2*Zhao Shiyun1Xu Jingjing1Zhao Nan1,2
1(SchoolofElectricalandElectronicEngineering,HubeiUniversityofTechnology,Wuhan430068,Hubei,China)2(HubeiCollaborativeInnovationCenterforHigh-efficiencyUtilizationofSolarEnergy,HubeiUniversityofTechnology,Wuhan430068,Hubei,China)
AbstractIn view of the existence of degradation factors such as ink infiltration, page stains or background texture in low-quality document images, this paper presents a binarisation algorithm for these images. First the algorithm detects the character strokes’ pixel based on local contrast of document image, then it performs global optimum thresholding on it via Otsu method, and finally it determines the neighbourhood window size through character stroke width estimation so as to achieve the precise segmentation of the character’s foreground and the background of pages. Experimental results show that the proposed algorithm significantly outperforms other classical document binarisation methods in terms of the performance indices including F-measure, PSNR, SSIM, NRM, and DRD metrics. This algorithm can effectively preserve the details of strokes, and can also well suppress the document background.
KeywordsDegraded document image binarisationLocal image contrastStroke width estimation